using functions overwrites the default hotkey Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Gangula
Posts: 31
Joined: 25 Oct 2017, 11:15

using functions overwrites the default hotkey

21 Sep 2018, 01:47

I have a script with "Win+R" as a hotkey. I used functions/subroutines for this hotkey and have the hotkey run only if a specific window is active. I want the hotkey to open the "Run Window" when that window is not active. But for some reason it doesn't do anything when the window is not active.
Below is the script.

Code: Select all

#r::HotKey("r") ; 

Hotkey(vMode:="") 
	{
		IfWinActive, ahk_exe Roamer.exe
		{
				if InStr(vMode, "r")
				{
					Send {F2}
					Send {Home}
					Send R -{Space}
					Send {Enter}					
				}
		}
	}
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: using functions overwrites the default hotkey  Topic is solved

21 Sep 2018, 02:53

it does exactly what u told it to do - return, ie nothing. use a directive

Code: Select all

#IfWinActive ahk_exe Roamer.exe
#r::HotKey("r") ; 

Hotkey(vMode:="") 
{
	if InStr(vMode, "r")
	{
		Send {F2}
		Send {Home}
		Send R -{Space}
		Send {Enter}					
	}
}
Gangula
Posts: 31
Joined: 25 Oct 2017, 11:15

Re: using functions overwrites the default hotkey

21 Sep 2018, 05:51

swagfag wrote:it does exactly what u told it to do - return, ie nothing. use a directive

Code: Select all

#IfWinActive ahk_exe Roamer.exe
#r::HotKey("r") ; 
..............

}
Thanks a lot

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jeves, scriptor2016 and 283 guests