Search the Community
Showing results for tags 'errors'.
-
Here's a trivial exemple of some simple computation going awry. The implementation language is mostly irrelevant (here, AutoIt) as you'd get about the same thing with C and the vast majority of languages. SillyFP.au3
-
Is there a way to have Aut2Exe write its error messages to the console (stdout/stderr) instead of popping up a message window? We build our project software using Bash scripts that compile AutoIt scripts, compile C programs, install data files, etc. If Aut2Exe encounters an error when compiling an AutoIt script it pops-up a message window, which is problematic when running from a Bash script. It's worse when part or all of the build is executed remotely via SSH: if you're watching the build, you can kill the local script if it gets stuck (i.e., is waiting for Aut2Exe to exit), but the Aut2Exe process is still running on the remote machine and has to be killed there. A local Aut2Exe already exits with a non-zero status once the window is closed (which is only a minor problem; see below). The big snag is the remote processing; cleaner local processing would be a plus. Note: For use in repetitive compilation testing, I created an AutoIt script that waits for Aut2Exe error windows to appear and closes them. In a Bash test-script, this error monitoring script is started in the background at the beginning of the test and killed at the end. This could be used with local builds, but I doubt it can be adapted to work on a remote machine since the remote SSH processes run in Windows Session 0 (including the login shell). Session 0 doesn't seem to be an issue if Aut2Exe exits normally, however. Any suggestions? (Abandoning remote compilation is not an option at the moment; we're trying to work our way out of that.)
-
Is there a way to catch errors in AutoIt? SImilar to java's "Try-Catch" methods? My program keeps on throwing errors and I need them to just go away, my program works fine, other than these errors. Here's my code: #NoTrayIcon #include #include #include #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #Obfuscator_Parameters=/cs /cf #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Opt("TrayMenuMode",1) ;$menu = TrayCreateItem("DriveLocker") ;$menu2 = TrayCreateItem("") ;$menuLock = TrayCreateItem("Lock Drive") ;TraySetState() HotKeySet("{F9}", "_LockDrive") HotKeySet("{PAUSE}", "_Switch") $running = True While 1 While ($running) $letter = DriveGetDrive("REMOVABLE") If IsArray($letter) Then For $i = 1 to $letter[0] _Check($letter[$i]) Next EndIf $time = TimerInit() While TimerDiff($time) < 10000 If IsArray($letter) Then For $i = 1 to $letter[0] _Check($letter[$i]) Next EndIf Sleep(100) WEnd WEnd Sleep(10*1000) WEnd Func _Switch() If ($running) Then $running = False Else $running = True EndIf EndFunc Func _Check($strDriveLetter) If ($running) Then If FileExists($strDriveLetter & "\AutoIt3\Locker\IAmLocked") Then _Unlock($strDriveLetter) ElseIf FileExists($strDriveLetter & "\lock.txt") Then _Unlock($strDriveLetter) EndIf EndIf EndFunc Func _Unlock($strDriveLetter) If ($running) Then $strPassword = InputBox("Security Check", "Enter your password.", "", "*", "", "", @DesktopWidth/2, @DesktopHeight/2,8, "passwordBox") ToolTip("Enter Password NOW.") _MouseTrap(@DesktopWidth, @DesktopHeight-100) If ($strPassword = "PASSWORD") Then _MouseTrap() ToolTip("") FileDelete($strDriveLetter & "\AutoIt3\Locker\IAmLocked") FileDelete($strDriveLetter & "\lock.txt") _ReAnimate($strDriveLetter) ElseIf ($strPassword = "PASSWORDFAILSAFE") Then _MouseTrap() ToolTip("") FileDelete($strDriveLetter & "\AutoIt3\Locker\IAmLocked") FileDelete($strDriveLetter & "\lock.txt") _ReAnimate($strDriveLetter) Else EjectVolume($strDriveLetter) ToolTip("") _MouseTrap() EndIf EndIf EndFunc Func _ReAnimate($strDriveLetter) ;Run(StringUpper($letter[$i]) & "\") ;Run(StringUpper($letter[$i]) & "\new.txt.lnk") ;Run(StringUpper($letter[$i]) & "\you.lnk") ;WinClose("AutoPlay") ;ProcessClose("mcagent.exe") EndFunc Func _LockDrive() $letter = DriveGetDrive("REMOVABLE") If IsArray($letter) Then For $i = 1 To $letter[0] If MsgBox(36,"Lock This Drive?","Do you wish to lock the " & StringUpper($letter[$i]) & " drive?") = 6 Then FileWrite($letter[$i] & "\AutoIt3\Locker\IAmLocked","Locked") _FileCreate($letter[$i] & "\lock.txt") ;EjectVolume($letter[$i]) EndIf Next EndIf EndFunc