is exit a safe command
-
- Posts: 115
- Joined: 06 Dec 2022, 02:35
is exit a safe command
hi , in documentation for exit command it is specifically written that the command does not work well . it exit current thread or sometimes whole script , does that mean the script runs in background while using exit command .
Re: is exit a safe command
Hallo,
if you think the command Exit does not work well, then you have not understood the documentation well.
Even if Exit is not explicitly in the script, every Autohotkey v1.1 script contains this command. Try to run this and you will see it in the error window.
if you think the command Exit does not work well, then you have not understood the documentation well.
Even if Exit is not explicitly in the script, every Autohotkey v1.1 script contains this command. Try to run this
Code: Select all
Switch
- DevWithCoffee
- Posts: 54
- Joined: 13 Oct 2020, 12:16
Re: is exit a safe command
The exit command is for finishing the Script itself, probably you want to close a GUI, but in that case you should use:
https://www.autohotkey.com/docs/v2/lib/Gui.htm#Destroy
Now if you are running routines you need to learn how to use Loop:
https://www.autohotkey.com/docs/v2/lib/Loop.htm#ExBreakContinue
Something I highly recommend:
https://www.autohotkey.com/docs/v2/Concepts.htm#boolean
One thing I recommend is always using some means to analyze the variables in your scripts in real time, remembering to remove them later. I use this one to keep the Debug window from getting in the way of testing operations:
https://www.autohotkey.com/docs/v2/lib/ToolTip.htm
Example:
https://www.autohotkey.com/docs/v2/lib/Gui.htm#Destroy
Now if you are running routines you need to learn how to use Loop:
https://www.autohotkey.com/docs/v2/lib/Loop.htm#ExBreakContinue
Something I highly recommend:
https://www.autohotkey.com/docs/v2/Concepts.htm#boolean
One thing I recommend is always using some means to analyze the variables in your scripts in real time, remembering to remove them later. I use this one to keep the Debug window from getting in the way of testing operations:
https://www.autohotkey.com/docs/v2/lib/ToolTip.htm
Example:
Code: Select all
... Public Variables ...
Loop
{
... My Script ...
Tooltip % "Var 1: " myvar "`nVar 2:" myvar2
If (condition to break...)
{
break
}
Sleep 10
}
ExitApp
Re: is exit a safe command
The exit command ends the current thread.
If you use a hotkey
pressing H will launch a new thread and end the new thread
but if you put Exit in the main thread,
it will exit the main thread, and because the main thread is the script, it will exit the script itself.
However, if you say the main thread can never be exited,
Then Exit does nothing (I think).
If you use a hotkey
Code: Select all
h:: Exit
but if you put Exit in the main thread,
Code: Select all
MsgBox
Exit
However, if you say the main thread can never be exited,
Code: Select all
#persistent
MsgBox
Exit
-
- Posts: 115
- Joined: 06 Dec 2022, 02:35
Re: is exit a safe command
Hi , @icehound
if used as hotkey than will it exit the current script.
if used as hotkey than will it exit the current script.
Re: is exit a safe command
It's working fine for me on v2
and v1
and v1