Tente algo assim:
#NoEnv
#SingleInstance Force
DetectHiddenWindows, On
SetTitleMatchMode, 2
Gui, Add, ListBox, gAction vChoise w190 h440 c66ff00, Inquiry_Callback||OptOut_UnSub|OptOut_Callback|dummy
return
^F1:: Gui, Show, x400 y180, Actions
Action:
If ((A_GuiEvent = "DoubleClick") || (Trigger_Action))
{
WinClose, _Actions.ahk - AutoHotkey v ahk_class AutoHotkey
Gui, Submit, NoHide
If (Choise = "dummy")
MsgBox, Reserved for Additional Customer
else
{
IfNotExist, %A_ScriptDir%\%Choise%_Actions.ahk
GoSub, Create_Choise_Script
Run, %A_ScriptDir%\%Choise%_Actions.ahk
}
}
return
Create_Choise_Script:
FileAppend,
(
#NoEnv
#SingleInstance Force
; Gui, -Caption
Gui, Add, ListBox, gCustomerAction vChoise w500 h50, customer1||customer2|customer3
WinGetPos, X, Y, Width,, Actions ahk_class AutoHotkeyGUI
Xn := (X+Width)
Gui, Show, x'%Xn'% y'%Y'%, %Choise%_Actions
return
CustomerAction:
If ((A_GuiEvent = "DoubleClick") || (Trigger_CustomerAction))
{
WinClose, Actions ahk_class AutoHotkeyGUI ; after pressing the final choice (the Customer), the ListBox will CLOSE
Gui, Submit
If (Choise = "customer1")
MsgBox, customer1
If (Choise = "customer2")
MsgBox, customer2
If (Choise = "customer3")
MsgBox, customer3
ExitApp
}
return
#If WinActive("%Choise%_Actions ahk_class AutoHotkeyGUI")
Enter::
Trigger_CustomerAction := true
GoSub, CustomerAction
Trigger_CustomerAction := false
return
Left:: ; go back
WinActivate, Actions ahk_class AutoHotkeyGUI
ExitApp
return
#If
GuiEscape:
GuiClose:
ExitApp
), %A_ScriptDir%\%Choise%_Actions.ahk
Return
#If WinActive("Actions ahk_class AutoHotkeyGUI")
Enter::
Right::
Trigger_Action := true
GoSub, Action
Trigger_Action := false
return
#If
GuiEscape:
GuiClose:
Gui, cancel
Return