Modifying a hotkey's default action when another hotkey is pressed

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Lem2001
Posts: 127
Joined: 27 Jun 2017, 17:59

Modifying a hotkey's default action when another hotkey is pressed

05 Jun 2019, 02:04

I have this command that I want to use only if the program magnify.exe is running.

Code: Select all

NumpadMult::
Send ^!{Space}
However, I use the ctrl+alt space key combination for another important system-wide command. Therefore, when I press NumpadMult while magnify is running, it triggers my system-wide action instead of just sending ctrl+alt space to magnfy.exe. The 'default' action is set in another program's option settings; it's not set by me using an AHK command.

Is there a way around this problem?

Using Send to send a series of commands to manually navigate to the option in question causes all sorts of problems and unwanted side-effects and doesn't work properly. So another approach is required.

I thought that if the default ctrl+alt space action was temporarily disabled whenever the NumpadMult was pressed (only while magnify.exe is running) and then immediately reset to its default behavior after the Send ^!{Space} command had been sent, that this would allow me to continue using ctrl+alt space for my default system-wide action, even when magnify.exe is running (because the code block to disable the default behavior would only be triggered when pressing the NumpadMult key. So, if NumpadMult was not pressed, then ctrl+alt space would continue to function as normal regardless of whether magnify.exe was running or not.

I don't know if the above is possible because it requires temporarily preventing a particular program from detecting and acting on its own settings for a moment.

I should point out that magnify.exe is a strangely behaving program, so many standard AHK commands that would work elsewhere don't work with magnify.exe (for example, it doesn't seem to work properly with WinActivate and is often sluggish to respond to other commands).

I'm not attached to any particular method of achieving this outcome; it's the reliability of the end result that counts. My comment above is just a suggestion, but obviously people with a greater understanding of the different capabilities of AHK will be able to come up with a greater range of ways to potentially achieve the desired outcome.

Thanks.
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

Re: Modifying a hotkey's default action when another hotkey is pressed

05 Jun 2019, 11:58

Maybe this command will help ? #If
and maybe use ControlSend instead of send?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, DataLife, Google [Bot], pgeugene, Rohwedder and 130 guests