How to SendInput without triggering hotkeys Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

How to SendInput without triggering hotkeys

10 Nov 2019, 16:16

When I use the following code, the script goes into recursion.

Code: Select all

^r::

	if( ! WinActive( "ahk_exe WINWORD.EXE" ) )
	{
		SendInput, ^r
		return
	}
	
	Run, ...

	return
How can I pass key presses invisibly to AutoHotkey, i.e. without false triggering? I tried to set different SendLevel values, but it did not affect.
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Re: How to SendInput without triggering hotkeys  Topic is solved

10 Nov 2019, 16:44

I just solved it by adding the #InputLevel 1 directive!

Code: Select all

#InputLevel 1

^r::

	if( ! WinActive( "ahk_exe WINWORD.EXE" ) )
	{
		SendInput, ^r
		return
	}
	
	Run, ...

	return
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: How to SendInput without triggering hotkeys

10 Nov 2019, 16:59

Usually, the $ modifier should suffice:
https://www.autohotkey.com/docs/Hotkeys.htm#Symbols wrote:$
This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself. [...]
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Re: How to SendInput without triggering hotkeys

10 Nov 2019, 19:22

gregster wrote:
10 Nov 2019, 16:59
Usually, the $ modifier should suffice:
https://www.autohotkey.com/docs/Hotkeys.htm#Symbols wrote:$
This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself. [...]
Thank you, $ is another option!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], bobstoner289, Google [Bot] and 298 guests