Potential bug AHK 1.1.33.10 script runs twice despite only being initiated once

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
penalvch
Posts: 6
Joined: 02 Feb 2021, 15:10

Potential bug AHK 1.1.33.10 script runs twice despite only being initiated once

17 Oct 2021, 13:16

Hi all,

I'm coming into a weird scenario using AHK 1.1.33.10. What is expected to happen is when I "Run As Administrator" the attached text.ahk script it runs one instance of the script.

What happens instead is it somehow runs two instances simultaneously. I'm not accidentally clicking it open twice. Please see following youtube video:
https://www.youtube.com/watch?v=Hn5Eizh6byk

Got any idea on wth is going on here?
Attachments
test.ahk
ahk script
(2.73 KiB) Downloaded 24 times
User avatar
mikeyww
Posts: 27124
Joined: 09 Sep 2014, 18:38

Re: Potential bug AHK 1.1.33.10 script runs twice despite only being initiated once

17 Oct 2021, 14:52

This is a test script that runs as admin.

Code: Select all

If !A_IsAdmin && !RegExMatch(DllCall("GetCommandLine", "str"), " /restart(?!\S)") {
 Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
 ExitApp
} Else CoordMode, Mouse

#IfWinActive ahk_exe test.exe
F3::Send x

#IfWinActive ahk_exe test2.exe
F3::Send y
#IfWinActive
If it works, expand it iteratively, testing carefully along the way.

Line 30 in your script will yield unexpected results. To prove it, you can run the following demo.

Code: Select all

If GetKeyState("LAlt", "P")
 F2::Send z
Read about #If in the documentation.
penalvch
Posts: 6
Joined: 02 Feb 2021, 15:10

Re: Potential bug AHK 1.1.33.10 script runs twice despite only being initiated once

20 Oct 2021, 00:55

mikeyww, thanks for the quick response and suggestions! I'll tweak around with it and report back if it doesn't work out. Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 123 guests