Activate window and execute key combination help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SquirrelHugger
Posts: 17
Joined: 23 Feb 2018, 04:17

Activate window and execute key combination help

23 Feb 2018, 04:24

Hello,

I have this following script:

Code: Select all

NumpadEnd::
	Run, "C:\Program Files\qBittorrent\qbittorrent.exe"
	Sleep, 500
	WinShow
	Sleep, 500
	Send ^+P
	Return
	
NumpadDown::
	Run, "C:\Program Files\qBittorrent\qbittorrent.exe"
	Sleep, 500
	WinShow
	Sleep, 500
	Send ^+S
	Return
The idea is that I always have qBittorrent.exe running wether it is in the taskbar or the window is active.
I want the script to find that window (qbittorrent) bring it to the front (since the key combination won't work unless qbittorrent is active) and execute CTRL+SHIFT+P or CTRL+SHIFT+S. And after that optionally hide the window again if it was hidden. However I am not able to show the window let alone hide it.

I am having a little of trouble since the script is working when the window is minimized but not when the window is in the taskbar (you know this small icon to the right next to the clock).

Appreciate any help, thank you!
:morebeard:
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Activate window and execute key combination help

23 Feb 2018, 05:54

What about WinActivate for when your application is only visible in tray?
Does running not activate it btw?
I am your average ahk newbie. Just.. a tat more cute. ;)
SquirrelHugger
Posts: 17
Joined: 23 Feb 2018, 04:17

Re: Activate window and execute key combination help  Topic is solved

23 Feb 2018, 07:13

I managed to fix it on my own after a few hours of head breaking :headwall:

Here is the code that works if anyone is interested:
Note: what is this code below? I have my main keyboard hooked up and an additional numpad hooked up on the side. I am using the additional numpad as a set of extra 9 micros (yes it works except one has to have the numlock on and the other off and everything works fine :dance: )

Code: Select all

NumpadLeft::Run, "D:\Downloads"
NumpadClear::Run "D:\myname\Videos\Movies"
NumpadRight::Run "D:\myname\Music"

NumpadHome::Send {ScrollLock}
NumpadPgUp::Send +{ScrollLock}
NumpadUp::Send !{ScrollLock}

NumpadPgDn::DllCall("LockWorkStation")

NumpadEnd::
	DetectHiddenWindows, On
	SetTitleMatchMode RegEx
		
	Run, "C:\Program Files\qBittorrent\qbittorrent.exe"
	WinWait, qBittorrent v4.0.3
	WinActivate
	#WinActivateForce
	Sleep, 100
	Send ^+P
	Return
	
NumpadDown::
	DetectHiddenWindows, On
	SetTitleMatchMode RegEx
	
	Run, "C:\Program Files\qBittorrent\qbittorrent.exe"
	WinWait, qBittorrent v4.0.3
	WinActivate
	#WinActivateForce
	Sleep, 100
	Send ^+S
	Return
:morebeard:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 307 guests