ExitCode
Posted: 01 Dec 2019, 06:46
I'm trying to use ExitCode to control how my script exits.
Is this how ExitCode is intended to be used, or are there scenarios where ahk posts its own unpredictable ExitCode, say for example if ahk encounters some runtime error and wants to quit?
In other words, is ExitCode completely under my control?
Is this how ExitCode is intended to be used, or are there scenarios where ahk posts its own unpredictable ExitCode, say for example if ahk encounters some runtime error and wants to quit?
In other words, is ExitCode completely under my control?
Code: Select all
OnExit("ExitApp")
ExitApp , 2
return
ExitApp(ExitReason, ExitCode){
If (ExitCode = 0){
MyFunction0()
ExitApp
}
If (ExitCode = 1){
MyFunction1()
ExitApp
}
If (ExitCode = 2){ ;this will execute
MyFunction2()
ExitApp
}
}