Created
June 1, 2021 16:02
-
-
Save JoeGlines/99d5912796462c3f83746d77f05df801 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance,Force | |
;********************Input box*********************************** | |
If (0){ | |
InputBox,Var,Name gathering,Enter your name,,,,,,,6 | |
if (ErrorLevel=1) | |
MsgBox,,InputBox Example, % "error Level:" ErrorLevel ": Cancel was hit",13 | |
if (ErrorLevel=2) | |
MsgBox,,InputBox Example, % "error Level:" ErrorLevel ": Timed out",13 | |
} | |
;**********Jean Lalonde Tip: Save Errorlevel 1st as something else can quickly overwrite it!*********************** | |
If (0){ | |
InputBox,Var,Jean Tip: Name gathering,Enter your name,,,,,,,3 | |
Err := ErrorLevel | |
if (Err=1) | |
MsgBox,,Jean Tip Example, % "error Level:" Err ": Cancel was hit",3 | |
if (Err=2) | |
MsgBox,,Jean Tip Example, % "error Level:" Err ": Timed out",3 | |
} | |
;********************ClipWait*********************************** | |
If (0){ | |
Clipboard:="" | |
ClipWait,1 ;Wait 1 second for Clipboard to have data | |
if (ErrorLevel=1){ | |
MsgBox ,, ClipWait example, % "error Level:" ErrorLevel " : Nothing entered",3 | |
return | |
} | |
} | |
;******On Error https://autohotkey.com/docs/commands/OnError.htm *********** | |
If (1){ | |
OnError("LogError") ;Put name of function here in quotes. The function is given the exception OBJECT as a parameter | |
%cause% := error | |
MsgBox Hello world ;Note, because of error, this is not reached | |
} | |
;********************LogError function*********************************** | |
LogError(exception) { | |
FileAppend % "Error on line " exception.Line ": " exception.Message "`n", errorlog.txt | |
Sleep, 100 | |
FileRead, Error_Log,errorlog.txt | |
DebugWindow(Error_Log,1) ;Shove into Debug window below | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment