Skip to content

Commit 4433237

Browse files
committed
Prevent LabStationPanel execution during Ahk2Exe compilation
Added compilation guard: script only executes Main() when running as compiled .exe or as .ahk script, but exits immediately during Ahk2Exe preprocessing to prevent hanging.
1 parent 24e9b04 commit 4433237

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

LabStationPanel.ahk

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44
#Requires AutoHotkey v2.0
55
#SingleInstance Force
66

7+
; Prevent execution during compilation
8+
;@Ahk2Exe-SetMainIcon img\favicon.ico
9+
if (A_LineFile = A_ScriptFullPath && !A_IsCompiled) {
10+
; Running as .ahk script - execute immediately
11+
Main()
12+
ExitApp
13+
}
14+
15+
; Auto-execute for compiled .exe
16+
if (A_IsCompiled) {
17+
Main()
18+
ExitApp
19+
}
20+
21+
; Compilation mode - do nothing, just parse
22+
ExitApp
23+
24+
Main() {
25+
TryExtractLogo()
26+
TryLaunch()
27+
}
28+
729
; Embed logo for compiled builds so the GUI can find it.
830
TryExtractLogo() {
931
if (!A_IsCompiled)
@@ -55,8 +77,3 @@ LS_LaunchElevated(target, args := "") {
5577
MsgBox "Unable to launch Lab Station with elevation: " . e.Message, "Lab Station Panel", "OK Iconx"
5678
}
5779
}
58-
59-
; Only run when script is executed (not during compilation)
60-
if (!A_IsCompiled || A_ScriptName = "LabStationPanel.exe") {
61-
TryLaunch()
62-
}

0 commit comments

Comments
 (0)