strange AHK running behavior .ahk file .vs compile

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DanRim
Posts: 153
Joined: 20 Jul 2018, 15:16

strange AHK running behavior .ahk file .vs compile

Post by DanRim » 19 Jan 2022, 01:25

Hello everyone,

I just wondering - does anyone had similar issue as mine: I creating AHK script at my work (sorry that I cannot share it), it works and at the same time does not work.

What I mean by that is if I run script from .ahk file directly script does not work, hotkey do nothing, no web scrapping and so on, but if I compile this script and then run it - it works.

What could be the reason why AHK behave this way?

AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: strange AHK running behavior .ahk file .vs compile

Post by AHKStudent » 19 Jan 2022, 01:35

test this script see if it's the same issue

Code: Select all

q::
msgbox, hello
ExitApp 

User avatar
boiler
Posts: 16903
Joined: 21 Dec 2014, 02:44

Re: strange AHK running behavior .ahk file .vs compile

Post by boiler » 19 Jan 2022, 04:34

When you run a .ahk file, do you see a green H icon appear in the system tray area of the Windows taskbar?

Are your file associations set up correctly for .ahk scripts? Sometimes users accidentally change them without realizing it after using “Open with…” and selecting something other than the AHK binary and making it the default. When you right-click on a .ahk file, is the first menu item named “Run Script”?

Perhaps your work has implemented something that is meant to prevent AHK scripts but did so by simply preventing .ahk files from executing but can’t discern a complied AHK file from other .exe files. I know at least one US state that performs geo-location and other checks before allowing users to use legal online gambling applications, and it will not let you place bets while a .ahk file is running, but it doesn’t complain when a compiled AHK script is running.

DanRim
Posts: 153
Joined: 20 Jul 2018, 15:16

Re: strange AHK running behavior .ahk file .vs compile

Post by DanRim » 25 Jan 2022, 16:34

Hello, Sorry for my late reply.

@boiler
"When you run a .ahk file, do you see a green H icon appear in the system tray area of the Windows taskbar?"
- Yes, I see. All looks like usual.

"Are your file associations set up correctly for .ahk scripts? Sometimes users accidentally change them without realizing it after using “Open with…” and selecting something other than the AHK binary and making it the default. When you right-click on a .ahk file, is the first menu item named “Run Script”?"
- I am not sure what it is "correctly associations". Some scripts work fine if I run from .ahk file as usual or then that file is compiled, but for some reasons there are some files which does not respond properly as they should. So I just wondering where could be the problem.
- Yes, when I right-click on .ahk file I see menu item named "Run Script". For compiled file I see "Open".

Perhaps your work has implemented something that is meant to prevent AHK scripts but did so by simply preventing .ahk files from executing but can’t discern a complied AHK file from other .exe files. I know at least one US state that performs geo-location and other checks before allowing users to use legal online gambling applications, and it will not let you place bets while a .ahk file is running, but it doesn’t complain when a compiled AHK script is running.
- This info sounds nice, I had know idea that it is possible - prevent file execution by geo-location. I wonder how they do, but maybe next time for this topic :). Regarding security - in company where I work AHK usage is allowed, I believe there is no such prevention. If I will find out problem I will leave comment here.

Post Reply

Return to “Ask for Help (v1)”