Firefox blocks Win-key macros from compile AHK scripts

Report problems with documented functionality
User avatar
Synetech
Posts: 13
Joined: 28 Nov 2015, 16:30

Firefox blocks Win-key macros from compile AHK scripts

08 Oct 2019, 06:45

I just posted a bug-report at the Firefox bug-tracker.

The problem is that if you create an AHK script that has a hotkey that uses the Windows key to Send text, it works everywhere as expected, unless you compile the script, in which case, it works everywhere except Firefox. It's a strange, very specific scenario. :wtf:

There's a a thread here that seems like it's probably related, but that seems to be fixed, so unless it's a regression, the two issues might be caused by a common, underlying issue. :think:
Last edited by joedf on 08 Oct 2019, 07:11, edited 4 times in total.
Reason: Fix link
User avatar
joedf
Posts: 7293
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Firefox blocks Win-key macros from compile AHK scripts

08 Oct 2019, 07:14

Hmm interesting... :think:
I'll give this a try later today.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
joedf
Posts: 7293
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Firefox blocks Win-key macros from compile AHK scripts

08 Oct 2019, 09:34

I have reproduced your case... :think:
So it seems the hotkey is still detected, but firefox doesnt get the "memo". If we use a msgbox, it shows the hotkey is still being detected...
If we use a sendinput instead, the desired behaviour is achieved. :+1:

Code: Select all

; ⊞Win+C should paste "foobar"
#c::sendInput foobar
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
lexikos
Posts: 6653
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Firefox blocks Win-key macros from compile AHK scripts

09 Oct 2019, 01:59

It works just fine on this Windows 7 computer.
User avatar
jNizM
Posts: 2509
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Firefox blocks Win-key macros from compile AHK scripts

09 Oct 2019, 02:05

It works for me also.

Tested on:
Windows 10 - 1903 (Build 18362.418)
Firefox 69.0.2 (64-Bit)
AutoHotkey 1.1.30.03 (compiled as 64-Bit Unicode)
[AHK] 1.1.30.03 x64 Unicode | [WIN] 10 Pro (Version 1903) x64 | [GitHub] Profile
Donations are appreciated if I could help you
malcev
Posts: 260
Joined: 12 Aug 2014, 12:37

Re: Firefox blocks Win-key macros from compile AHK scripts

09 Oct 2019, 02:49

For me works compiled script in firefox 69.0.2 (64-bit), Win10 LTSC, ahk 64 bit 1.1.31.

Code: Select all

#c::send foobar
User avatar
joedf
Posts: 7293
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Firefox blocks Win-key macros from compile AHK scripts

09 Oct 2019, 08:25

I just tried again today.... and it worked either way... hmmm

Test System Info:
Spoiler
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
Synetech
Posts: 13
Joined: 28 Nov 2015, 16:30

Re: Firefox blocks Win-key macros from compile AHK scripts

17 Oct 2019, 10:55

joedf wrote:
09 Oct 2019, 08:25
If we use a sendinput instead, the desired behaviour is achieved. … I just tried again today.... and it worked either way... hmmm
Hmm, indeed. I tried it with sendinput, but it didn't work. Then I reverted it to send and added a msgbox call to see the hotkey just before the send command, and now it. :think: Now I'm wondering if it's a race-condition, some sort of timing issue. I'm not sure why this only affects Firefox though. :eh:

I just tried it in a fresh VM and got the same results on my main system:
  • All versions work in Windows Explorer, Notepad, Chrome, everywhere
  • All version of raw script work in Firefox
  • Compiled script with msgbox before send works in Firefox
  • Compiled script without msgbox (with send or sendinput) does NOT work in Firefox
  • Replacing msgbox with tooltip makes it stop working in Firefox again
  • Adding a sleep delay doesn't make it work, only msgbox seems to work
I just downloaded the latest version of AHK and compiled it with the .bin files from that and it seems to work. I'm not sure what's different (maybe the compiler was defaulting to ANSI instead of Unicode—which still wouldn't explain why it was only failing in Firefox). Regardless, it seems to work properly now.

Also, I don't use the compiler that comes with AutoHotkey, I use the old compiler-wrapper (with the joystick icon) which provides a lot more control over the resulting executable. Passing the new (Unicode) .bin file to the old compiler also works. 👍 (I don't know why Unicode emojis are so huge on this message board. 🤔)

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 8 guests