 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
V@no
Joined: 13 Sep 2007 Posts: 37
|
Posted: Sun Mar 23, 2008 11:01 pm Post subject: Reload - make sure it was successful? |
|
|
Hello!
I've been using this little snippet that automatically restarts the script if it was modified, which saves lots of clicking when you test something | Code: | FileGetTime, ScriptModified, %A_ScriptFullPath%, M
SetTimer, CheckReload, 100
Goto SkipCheckReload
CheckReload:
FileGetTime, ScriptModifiedC, %A_ScriptFullPath%, M
If (ScriptModifiedC <> ScriptModified)
{
Reload
ExitApp
}
Return
SkipCheckReload:
;rest of the script |
This works great with persistent scripts except for one thing: if you make a critical mistake in the code, the script will quit.
Now, here's the question: how do I detect if script was reloaded without errors?
Thank you. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2737 Location: Australia, Qld
|
Posted: Mon Mar 24, 2008 5:59 am Post subject: |
|
|
| Code: | Reload
Sleep, 1000
; If the reload succeeded, the script would have already terminated.
MsgBox RELOAD FAILED
| It may be possible for this to fail if the computer is under heavy load, though. (i.e. It takes longer than one second to reload the script, but it eventually succeeds.) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|