Chris86 Posted March 6, 2009 Posted March 6, 2009 How can i detect if my script crashes or something?
Developers Jos Posted March 6, 2009 Developers Posted March 6, 2009 Well thats easy, when it "crashes" it will show some sort of warning/msgbox. .. but I have the feeling you were not looking for this answer. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Yashied Posted March 6, 2009 Posted March 6, 2009 How can i detect if my script crashes or something?If you do not fit OnAutoItExit(), try to write a second script that will monitor the crash of the first script, for example, using the ProcessExists(). while 1 if not ProcessExists('MainScript.exe') then MsgBox(16, 'Error', 'MainScript.exe crashed!') exit endif Sleep(10) wend My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Chris86 Posted March 6, 2009 Author Posted March 6, 2009 Is it possible to have something in the script that doesn't need a another program to determine if the mainscript fails? I need this for bug reporting on my website
Yashied Posted March 6, 2009 Posted March 6, 2009 Is it possible to have something in the script that doesn't need a another program to determine if the mainscript fails?I need this for bug reporting on my website If your script is crashed (it is not in memory), what program do you think should record the event? If you do not like the second program can use the RegRead() and RegWrite() functions. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
JSThePatriot Posted March 6, 2009 Posted March 6, 2009 If you have proper bug catching and reporting you won't have to worry about a crash because you'll already know. I think you just need to add in some error checking into your script, and you'll be golden. Regards, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Prab Posted March 6, 2009 Posted March 6, 2009 (edited) @JSThePatriot - You can't account for everything. I consider it a crash if somebody uses taskmanager to end the process. There is no way to add that error checking to your script. Make a helper script like this $return = RunWait("yourprog.exe")) If $return = 0 Then MsgBox(0,"","Script exited normally") Else MsgBox(0,"","Script crashed") EndIf Most programs/scripts will return 0 as success, just make sure that yours does the same. Edit: Just reread Is it possible to have something in the script that doesn't need a another program to determine if the mainscript fails?. My solution doesn't, but by using Fileinstall() you could only have one exe. Edited March 6, 2009 by Prab FolderLog GuiSpeech Assist
Developers Jos Posted March 6, 2009 Developers Posted March 6, 2009 Edit: Just reread . My solution doesn't, but by using Fileinstall() you could only have one exe.You can use 1 script to do both tasks. I am doing a similar thing in AutoIt3Wrapper which is always running 2 times when you hit compile.One will monitor the version doing the actual compile and do a cleanup when the compile is canceled by the "Tools/Stop Executing"Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
JSThePatriot Posted March 6, 2009 Posted March 6, 2009 @JSThePatriot - You can't account for everything. I consider it a crash if somebody uses taskmanager to end the process. There is no way to add that error checking to your script. Make a helper script like this $return = RunWait("yourprog.exe")) If $return = 0 Then MsgBox(0,"","Script exited normally") Else MsgBox(0,"","Script crashed") EndIf Most programs/scripts will return 0 as success, just make sure that yours does the same. Edit: Just reread . My solution doesn't, but by using Fileinstall() you could only have one exe.I believe the end process would still try to call the OnAutoItExit function that can be specified through the options. Then I would recommend using Jos' method to preform any other tasks that a "second" script would perform. Thanks, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Yashied Posted March 9, 2009 Posted March 9, 2009 Try this. #NoTrayIcon if ($CmdLine[0] > 0) and ($CmdLine[1] = '/run') then _RunScript() else local $ExitCode = ShellExecuteWait(@ScriptFullPath, '/run', @ScriptDir) if not @error then switch $ExitCode case 0 MsgBox(0, 'Report', 'The script has finished work successfully.') case else MsgBox(0, 'Report', 'The script is crashed!') endswitch else MsgBox(0, 'Report', 'Error when calling the "ShellExecute" function!') endif exit endif func _RunScript() ; This is your code if MsgBox(36, 'YourProg', 'Your script is running. Press "Yes" to crash this script or "No" to normaly exit.') = 6 then DllCall('kernel32.dll', 'int', 'FatalExit', 'int', 1) else exit endif endfunc; _RunScript My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now