I have a small script with two buttons. How can I add a behavior that the compiled GUI.exe should close after returning from a subroutine?
The Idea is no matter which button is pressed the GUI should close completely even from the tray-icon-area.
I tried to figure it out but I could not find a solution.
Could you help me please?
Thank you.
Regards,
ScripterUser
Code: Select all
#SingleInstance, Force
Gui, Add, Button, x10 y+5 w250 h50 gSubroutine1, start Subroutine1
Gui, Add, Button, x10 y+5 w250 h50 gSubroutine2, start Subroutine2
Subroutine1:
If !FileExist(A_ScriptDir . "\file1.txt")
{
MsgBox, file: "file doesn't exist!
}
else
{
FileCopy, %A_ScriptDir%\file1.txt, %A_ScriptDir%\file_copy.txt, 1
Msgbox, file copied!
}
return
Subroutine2:
If !FileExist(A_ScriptDir . "\file2.txt")
{
MsgBox, file: "file doesn't exist!
}
else
{
FileCopy, %A_ScriptDir%\file2.txt, %A_ScriptDir%\file_copy.txt, 1
Msgbox, file copied!
}
return
^NumPad1::ExitApp ; This line will be removed later
[Mod action: Moved topic to v1 section. The main section is for v2.]