Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/07/2016 in all areas

  1. AutoIt Version: 3.3.10.2+ UDF Version: 2.0 Description: This library allows to register function for AutoIt critical errors. Usually it's syntax errors, or array-related errors. By default the UDF shows custom debug dialog, although it is not possible to perform any real debugging, but we can for example display the error message, restart application, send bug report, or just close the application. Example #1 - Displaying built-in dialog when error is received: #NoTrayIcon #AutoIt3Wrapper_Run_Before=%autoitdir%\AutoIt3.exe /AutoIt3ExecuteLine "FileClose(FileOpen('%scriptdir%\OAER_RAW_SRC.tmp', 2))" #AutoIt3Wrapper_Run_After=%autoitdir%\AutoIt3.exe /AutoIt3ExecuteLine "FileDelete('%scriptdir%\OAER_RAW_SRC.tmp')" #include <GUIConstantsEx.au3> #include 'OnAutoItErrorRegister.au3' _OnAutoItErrorRegister('', '', 'My App Error', False, False) GUICreate('OnAutoItErrorRegister Example', 350, 200) GUICtrlCreateLabel('This script is just an example.' & @CRLF & @CRLF & 'It will produce a syntax error in', 25, 40, 300, 50) GUICtrlCreateLabel('5', 185, 50, 50, 40) GUICtrlSetColor(-1, 0xF20000) GUICtrlSetFont(-1, 30, 800, 0, 'Tahoma') GUICtrlCreateLabel('seconds.', 220, 67, 300, 50) GUICtrlCreateLabel('The result shown as a CUSTOM error message, you can change it!', 25, 120, 350, 20) $iUnRegister_Bttn = GUICtrlCreateButton('UnRegister AutoItError handler', 25, 140, 200, 22) GUICtrlCreateLabel('Copyright jennico, G.Sandler (MrCreatoR) © 2008 - 2015', 25, 170, 350, 80) GUICtrlSetColor(-1, 0x808080) GUICtrlSetFont(-1, 8.5, 800, 6) GUISetState() Dim $iTimer For $i = 3 To 1 Step -1 GUICtrlSetData(4, $i) $iTimer = TimerInit() While TimerDiff($iTimer) < 1000 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $iUnRegister_Bttn _OnAutoItErrorUnRegister() EndSwitch WEnd Next ;We deliberately make a syntax mistake and call the error! If Random(1, 5, 1) = 3 Then MsgBox(0, '', ) Else _NotExistingFunc() EndIf Example #2 - Call user defined function when receiving error (script restart): #NoTrayIcon #AutoIt3Wrapper_Run_AU3Check=n ;!!! This must be used to ensure that raw source file is generated before compilation (because $bSetErrLine is True) #AutoIt3Wrapper_Run_Before=%autoitdir%\AutoIt3.exe "%in%" /BC_Strip #AutoIt3Wrapper_Run_After=%autoitdir%\AutoIt3.exe /AutoIt3ExecuteLine "FileDelete('%scriptdir%\OAER_RAW_SRC.tmp')" #pragma compile(Stripper, False) #include 'OnAutoItErrorRegister.au3' _OnAutoItErrorRegister('_MyErrorHandler', '', '', False, True) ;We deliberately make an array bounding error and call the error! Dim $aArr[1] MsgBox(0, '', $aArr[1]) Func _MyErrorHandler($sScriptPath, $iScriptLine, $sErrDesc, $vParams, $hBitmap) ;Restart the application Local $sMessage = StringFormat('SCRIPT FILE:\n%s\n\nSCRIPT ERROR LINE:\n%s\n\nERROR DESCRIPTION:\n%s', $sScriptPath, $iScriptLine, $sErrDesc) If StringInStr($CmdLineRaw, '/ErrorStdOut') Then If FileExists(@WindowsDir & "\Media\chord.wav") Then SoundPlay(@WindowsDir & "\Media\chord.wav") Else DllCall('user32.dll', 'int', 'MessageBeep', 'int', 0x00000010) EndIf EndIf If MsgBox(BitOR($MB_SYSTEMMODAL, $MB_YESNO), 'Crash recieved!', 'Restart application?' & @CRLF & @CRLF & $sMessage) <> 6 Then Return EndIf Local $sRunLine = @AutoItExe & ' "' & @ScriptFullPath & '"' If @Compiled Then $sRunLine = @ScriptFullPath EndIf Run($sRunLine, @ScriptDir) EndFunc Download: OnAutoItErrorRegister.zip (Counter: ) Screenshot: ChangeLog: Initial idea by jennico: Author(s): G.Sandler (MrCreatoR), jennico Notes: The UDF can not handle crashes that triggered by memory leaks, such as DllCall crashes, "Recursion level has been exceeded..." (when using hook method ($bUseStdOut = False)).When using StdOut method ($bUseStdOut = True), CUI not supported, and additional process executed to allow monitor for errors.After using _OnAutoItErrorUnRegister when $bUseStdOut = True, standard AutoIt error message will not be displayed on following syntax error.To use the "Send bug report" feature, there is need to fill related parameters (variables) under the «User Variables» section in UDF file (check the comments of these variables), or just build your own user function.[If $bSetErrLine is True...] Script must be executed before compilation (after any change in it), or use '#AutoIt3Wrapper_Run_Before=%autoitdir%\AutoIt3.exe "%in%" /BC_Strip' in your main script. Do NOT use Au3Stripper when compiling the main script if you want correct error line detection for compiled script. To get correct code line for compiled script, the script is transformed to raw source (merging includes) and FileInstall'ed when it's needed (on error), therefore, the script is available in temp dir for few moments (when error is triggered), although it's crypted, but developer should ensure that his script is more protected. [If $bSetErrLine is False...] Use supplied GetErrLineCode.au3 to get proper error line code by line number from error that was triggered in compiled script.
    1 point
  2. Jos

    OutlookEX UDF

    correct in case au3check is able to catch this issue. Else run au3stripper with the /MergeOnly parameter and you should get a merged scriptfile that should be pretty close to the source included in the compiled script. Jos
    1 point
  3. @dreivilo47 look again at the example script in the help file. Notice the & symbol in front of the menu item...
    1 point
  4. Update: . IRC.au3 Fixed : Updated Headers to UDF-spec (- instead of =) _IRCGetMsg Fixed : Incorrect Return Value On Error _IRCStripSpecial Added : Better documentation of Flags _IRCMultiSendMsg Added : Better documentation of Flags _IRCMultiSendMsg Fixed : Max Message Size based on https://forums.unrealircd.org/viewtopic.php?t=6811 Updated all files to consider themselves a standalone install by default All Functions that didn't Return anything now return Number of bytes sent Slight Performance Improvements by using Parameter Gating instead of Single Input Single Output
    1 point
  5. I am all for it, I have a couple of PMs, but no wider interest yet. Lets move!
    1 point
  6. Copy the old String.au3 UDF and extract the relevant function(s) then include it(them) in your application and compile using your up-to-date installation.
    1 point
  7. _StringEncrypt and friends were removed due to terrible bugs, so it isn't recommended for new design of course. The _Crypt* function rely on much stronger feet but aren't anyway compatible with this "encryption". You should download an old version of AutoIt (prior to 3.3.10.0) to extract the _StringDecrypt function used at that time.
    1 point
×
×
  • Create New...