How to ignore mapped key Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
piteros

How to ignore mapped key

03 Nov 2015, 03:28

I've got 2 hotkeys:

Code: Select all

1::
send, QWE
return,

Code: Select all

2::
send, 1QAZ1
return,
When i press "2" then result is: QWEQAZQWE instead 1QAZ1, how to ignore 1st hotkey when im using 2nd hotkey?
Paneb
Posts: 54
Joined: 24 Aug 2015, 05:02
Location: France
Contact:

Re: How to ignore mapped key

03 Nov 2015, 03:35

Try this one:

Code: Select all


 #NoEnv
 #SingleInstance force
 #Persistent
 
 
$1::
send, QWE
return
2::
send, 1QAZ1
return
http://ahkscript.org/docs/Hotkeys.htm
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to ignore mapped key

03 Nov 2015, 19:11

@piteros: You just need $ as demonstrated by Paneb; the other changes are irrelevant. Alternatively, #UseHook would apply to all hotkeys.

@Paneb: FYI, #Persistent has no effect in scripts which have hotkeys.
Paneb
Posts: 54
Joined: 24 Aug 2015, 05:02
Location: France
Contact:

Re: How to ignore mapped key  Topic is solved

04 Nov 2015, 02:28

lexikos wrote: @Paneb: FYI, #Persistent has no effect in scripts which have hotkeys.
Indeed, just a line from the test.ahk I mostly used to run some code besides mine ^^.
The #SingleInstance is irrelevant too? I mean, if there is two instances it could send two hotkey at the same time no?

Nevermind, I just tried it and got the warning message box which doesn't allow two instances anyway!
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to ignore mapped key

04 Nov 2015, 03:25

I mean, if there is two instances it could send two hotkey at the same time no?
If there were two instances, only one of them would detect and react to the hotkey. Hotkeys without ~ block the keypress from other scripts just as they block it from the active window.

When you make multiple changes to a script without explaining what they are or which one actually solves the problem, I suppose that it is more difficult for others to see the solution.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Billykid, dinodragon, Google [Bot], mcd and 155 guests