For Experts: Why does AutoHotkey not Work in Certain Programs?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
BannerStore
Posts: 87
Joined: 06 Sep 2017, 19:29

For Experts: Why does AutoHotkey not Work in Certain Programs?

21 Apr 2020, 10:33

Question
Why does AutoHotkey not work in certain programs? And, how do I prevent these certain programs from interfering with AutoHotkey?


Expected Behavior
When I open programs, I rely on AutoHotkey to close the program because certain programs do not go with the flow and they will close their window in a unique way. For example, instead of the normal Control-W, one special program (PhraseExpress) annoyingly requires that you use a special hotstring to close its window (Alt, F, C). It's usually not a pain because I have AutoHotkey! When I press Control-W, AutoHotkey will immediately intercept this hotkey and will instead send the appropriate hotstring which will close the PhraseExpress window.

This is awesome because I have a dedicated mouse button that always closes program windows. I can just always use my mouse and its many programmable buttons to move around, open programs, cut and paste, close things and much other stuff. It's cool. I neither have to use my left hand at all nor have to lift my right hand from my mouse to the keyboard. If a special program has a special way of closing windows, I can just easily program AutoHotkey to remap what Control-W does when that special program is open. I do this for many programs and it takes me only about 5 seconds of scripting. For example, if a special program requires me to press Control-Z to close a window, my mouse will first send Control-W, AutoHotkey will immediately intercept it, and will finally send Control-Z instead. Life is perfect!


Actual Behavior :headwall:
For one very special program (PhraseExpress), AutoHotkey does nothing. When PhraseExpress's window is active, AutoHotkey will not intercept Control-W and will not resend the unique hotstring of Alt, F, C. Actually, AutoHotkey won't do most things while the PhraseExpress window is active.

Strangely, it will do some things like open programs like Chrome while the PhraseExpress window is active. It appears that AutoHotkey just won't do anything that deals with PhraseExpress. Why?


Possible Reasons, Analysis, & Solution :think:
Perhaps, PhraseExpress tells the computer that PhraseExpress is always first in line. In other words, AutoHotkey can't respond to Control-W because PhraseExpress intercepts it first. I don't think this is true because Control-W isn't even defined for PhraseExpress. When Control-W is sent to PhraseExpress, it's not supposed to do anything with it anyway but who knows. I'm not sure but it also appears that you can't send anything to PhraseExpress via another program. I might be wrong about this. Somebody mentioned something about key hooks. I don't know what a key hook is but if PhraseExpress is stealing keyhooks, they should compensate the owners. Stealing is wrong.

Any experts out there know what's going on? By the way, PhraseExpress is a spelling correction program. Please help me. I will give you my left arm. (I won't need it if you help me fix this!)
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: For Experts: Why does AutoHotkey not Work in Certain Programs?

21 Apr 2020, 15:08

Hi,

I'm certainly not an expert, but you could try two things:
Either SendLevel, 2 or ControlSend

If you don't know these commands, I suggest you to check the AHK documentation in order to see some examples.

Good luck
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: For Experts: Why does AutoHotkey not Work in Certain Programs?

21 Apr 2020, 16:54

This sounds like a program running as admin
When such program is active,any hotkeys from AHK(if ahk is not running the script as admin)will be ignored

As an example you can set a single hotkey to just display a message box,open task manager and try pressing that hotkey...nothing will happen.
I also have a weird program(not running as admin)that will not accept anything unless the window is active and the mouse is over that window

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, CrowexBR, Google [Bot], Rohwedder and 202 guests