Jump to content

Search the Community

Showing results for tags 'exception'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 4 results

  1. Hello mates. I would like to share simple but very important function required durning code many *au3 files. Such as function is used by a few scripts developers on forum but most of users waste a lot of time to make his functions/tool free from errors and bugs. How is working? This function do not check errors like Scite debugger. You can be able to make something like call exceptions in Python. Think about this and think when you ran some code, no error but also do nothing. 0 information and you have to jump into own or other script to find out reason. Function: Updated 2018-02-04, 08:47 (fixed AutoIt problem with dedection @ScriptName) ;============================================================================================================================================================== ; Function: Exception ([ $sInfo = "" [, $vReturnValue = Null [, $vExtended = @extended [, $iErrorNr = @error [, $iErrorLine = @ScriptLineNumber ]]]]]) ; ; Description: Call exceptions in different *au3 files located in this same Folder. ; ; Parameter(s): $sInfo - Information about exception in code, created by yourself. ; $vReturnValue - (Default=Null) Set value to return durning exception. ; $iErrorNr - (Default=@error) Set the error manually by adding a number. ; $vExtended - (Default=@extended) Set extended manually. ; $iErrorLine - Internal use do not change! ; ; Return Value(s): $vReturnValue, ; Additional: Output string in Scite Console about debug trace. ; ; Author (s): Who cares? ;============================================================================================================================================================== Func Exception($sInfo="", $vReturnValue = Null, $iErrorLine = @ScriptLineNumber, $iErrorNr = @error, $vExtended = @extended) Dim $aArray[0] Local $sScriptPath = @ScriptFullPath Local $sCurrentScriptLine = StringLower(FileReadLine($sScriptPath, $iErrorLine)) If Not StringInStr($sCurrentScriptLine, "exception") Then Local $aInclude = FileReadToArray($sScriptPath) For $sItem In $aInclude Local $sLowerLine = StringLower($sItem) If StringInStr($sLowerLine, "#include") Then Local $sIncludeName = StringTrimLeft($sItem, 8) Local $sConvertedName = "" Local $bAdd = False Local $aDelimeter = ["<", ">"] If StringInStr($sIncludeName , "'") Then $aDelimeter[0] = "'" $aDelimeter[1] = "'" ElseIf StringInStr($sIncludeName , '"') Then $aDelimeter[0] = '"' $aDelimeter[1] = '"' EndIf Local $aSplitInclude = StringSplit($sIncludeName, "") For $sSign In $aSplitInclude If $sSign = $aDelimeter[0] And Not $bAdd Then $bAdd = True ContinueLoop ElseIf $sSign = $aDelimeter[1] And $bAdd Then ReDim $aArray[UBound($aArray) + 1] $aArray[UBound($aArray) - 1] = $sConvertedName ExitLoop EndIf If $bAdd Then $sConvertedName &= $sSign Next EndIf Next EndIf If UBound($aArray) > 0 Then For $sName In $aArray Local $sPath = @ScriptDir & "\" & $sName If FileExists($sPath) Then $sCurrentScriptLine = StringLower(FileReadLine($sPath, $iErrorLine)) If StringInStr($sCurrentScriptLine, "exception") Then $sScriptPath = $sPath ExitLoop EndIf EndIf Next EndIf Local $aFile = FileReadToArray($sScriptPath) Local $sFunctionName, $sLine Local $bFound = False For $i = 0 To $iErrorLine - 1 If $bFound Or $iErrorLine <= 0 Then ExitLoop $sLine = StringReplace($aFile[$iErrorLine - $i], @TAB, "") If StringInStr(StringLower($sLine), "func ") Then Local $aSortLine = StringSplit($sLine, '') $sLine = "" For $h = 1 To $aSortLine[0] - 1 Local $sLowerSort = StringLower($aSortLine[$h]) If $sLowerSort = "(" Then $bFound = True ExitLoop ElseIf $sLowerSort <> @TAB And $sLowerSort <> " " Then If $sLowerSort = "f" Or $sLowerSort = "u" Or $sLowerSort = "n" Or $sLowerSort = "c" Then $sLine &= $aSortLine[$h] Else If Not StringInStr($sLine, "func") Then $sLine = "" ExitLoop Else $sLine &= $aSortLine[$h] EndIf EndIf EndIf Next EndIf Next If StringLeft(StringLower($sLine), 4) <> "func" Then $sLine = "" EndIf $sFunctionName = StringTrimLeft($sLine, 4) If StringLen($sFunctionName) < 1 Then $sFunctionName = "not recognized" Else $sFunctionName &= " ( ... )" EndIf If StringLen($sInfo) < 1 Then $sInfo = "nothing about" EndIf $vRet = $vReturnValue If $vRet = Null Then $vRet = "Null" ElseIf IsArray($vRet) Then $vRet = "an Array with " & UBound($vRet) & " items" ElseIf IsBinary($vRet) Then $vRet = "binary " & $vRet ElseIf IsBool($vRet) Then $vRet = "bool " & $vRet ElseIf IsDllStruct($vRet) Then $vRet = "dll struct " & $vRet ElseIf IsFloat($vRet) Then $vRet = "float " & $vRet ElseIf IsHWnd($vRet) Then $vRet = "hwnd " & $vRet ElseIf IsInt($vRet) Then $vRet = "int " & $vRet ElseIf IsKeyword($vRet) Then $vRet = "keyword " & $vRet ElseIf IsNumber($vRet) Then $vRet = "number " & $vRet ElseIf IsObj($vRet) Then $vRet = "object " & $vRet ElseIf IsPtr($vRet) Then $vRet = "ptr " & $vRet ElseIf IsString($vRet) Then If $vReturnValue = "" or StringReplace($vRet, " ", "") = "" Then $vRet = 'empty string ""' Else $vRet = 'string "' & $vRet & '"' EndIf EndIf Local $sStruct $sStruct &= "! Exception = {" & @CRLF $sStruct &= "!" & @CRLF $sStruct &= "!" & @TAB & '"date" = ' & @YEAR & "-" & @MON & "-" & @MDAY & ", " & @HOUR & ":" & @MIN & ":" & @SEC & ", " & @MSEC & "ms," & @CRLF $sStruct &= "!" & @TAB & '"path" = ' & $sScriptPath & "," & @CRLF $sStruct &= "!" & @TAB & '"line" = ' & $iErrorLine & "," & @CRLF $sStruct &= "!" & @TAB & '"func" = ' & $sFunctionName & "," & @CRLF $sStruct &= "!" & @TAB & '"retn" = ' & $vRet & "," & @CRLF $sStruct &= "!" & @TAB & '"exten" = ' & $vExtended & "," & @CRLF $sStruct &= "!" & @TAB & '"error" = ' & $iErrorNr & "," & @CRLF $sStruct &= "!" & @TAB & '"info" = ' & $sInfo $sStruct &= @CRLF $sStruct &= "!" & @CRLF $sStruct &= "! }" & @CRLF & @CRLF ConsoleWrite($sStruct) Return $vReturnValue EndFunc ;==> Exception How to use? - Example 1 Func Example() Local $sFile = FileOpen(@ScriptDir & "\example.py") If $sFile = -1 Then Return Exception("Failed to open 'example.py', File not exist!") EndIf ; continue working EndFunc Example() Example 1 Output in Scite console: Example 2 Func Example2() Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1.Fake") ; added .Fake to make object wrong. If Not IsObj($oHttp) Then Return Exception("Failed to create Object in variable $oHttp.", 2.2) EndIf ; continue working EndFunc Local $vRet = Example2() ConsoleWrite("$vRet = " & $vRet & @CRLF) Example 2 Output in Scite console:
  2. I'm using csharp with the autoitx3. I added to my project referenced the autoit dll's. Everything was working find until I got exception say: "Unable to load DLL 'AutoItX3_x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" And I downloaded and installed the autoit and added the dll files referenced them to my project also the file name: AutoitX3_x64.dll but for some reason I don't see this dll file in the project tried to add it as reference few times and in the References I see only two files of Autoit: AutoItX3.Assembly.dll and Interop.AutoItX3Lib.dll but for some reason it's not adding the AutoitX3_x64.dll as reference. How should I add then the AutoitX3_x64.dll to my project ? I keep getting the exception message that it's missing.
  3. Howdy, In a bizarre twist of events a client installed McAfee Antivirus Plus (the paid version). I have scripts running there, the simplest is a little HTTP downloader, which opens HTML pages and downloads some files. These scripts have been running for years. The new AV kills the process. The process just "disappears" with no warning. I can not find an "exception" setting. IT on site had to kill it in the Task Manager and restart the PC. All other AV products (even the free ones) have an easily accessible Exception setting. Note that the standard McAfee that typically comes with Acrobat does not do this, yet. Any advice on this please? Other than "get a new AV"? This has been suggested and as they just dished out the cash, not a current option.
  4. I simultanously run some threads and from time to time I have a message, that there is concurrent deadlock exception (update conflict with concurrent update). I know, that it sometimes happens, but is it possible to somehow turn off displaying messaging from Firebird? Or better somehow handle this exceptions ?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.