Jump to content

Error routine doesn't show when running compiled


Docfxit
 Share

Recommended Posts

I have a script that does show an error when run un-compiled.  When It's compiled it doesn't show the error.

Could someone please help me figure out why it isn't showing when it's compiled?

This is my script:

Save this as: ScanFiles.au3

#include <WinAPI.au3>
#include <_ErrorHandler29.au3>
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number

Global $iError = 0, $iExtended = 0
Global $tText = DllStructCreate("char Text[4096]")
Global $pText = DllStructGetPtr($tText), $sMessage = "<None>"
If @error = 1 Then
    DriveMapAdd("L:", "\\ATU1277\Scans", 0, "ATU1277\SCANS", "Password"); Local account on remote computer
     _CheckError(@error, @extended)
EndIf
$Line1 = $CMDLINE[1]

; View a document...
If $CMDLINE[1] = "V" Then
    Run("C:\PROGRA~1\IRFANVIEW\I_VIEW32" & " " & "L:\" & $CMDLINE[2])
Else
    ; Scan a document
    If $CMDLINE[1] = "S" Then
        Run("C:\PROGRA~1\IRFANVIEW\I_VIEW32" & " /scan /convert=" & "L:\" & $CMDLINE[2])
    Else
        MsgBox(0x40000, 'CMDLINE  Error', "Error" & @CRLF & "Passed Paramater 0 = " & $CMDLINE[0] & @CRLF & "Passed Paramater 1 = " & $CMDLINE[1] & @CRLF & "Passed Paramater 2 = " & $CMDLINE[2])

    EndIf
EndIf
Exit

Func _CheckError($iError, $iExtended = '')
 $iExtended)
    If $iError <> 0 Then
        Switch $iError
            Case 1
                _WinAPI_FormatMessage($FORMAT_MESSAGE_FROM_SYSTEM, 0, $iExtended, 0, $pText, 4096, 0)
                $sMessage = DllStructGetData($tText, "Text")
                MsgBox(0, "Error Mapping Drive", "@error = " & $iError & @CRLF & _
                        "@iExtended = " & $iExtended & @CRLF & _
                        "Message = " & $sMessage)
            Case 2
                MsgBox(16, "ERROR", "Access to the remote share was denied.")
            Case 3
                MsgBox(64, "WARNING", "The device is already assigned.")
            Case 4
                MsgBox(16, "ERROR", "Invalid device name.")
            Case 5
                MsgBox(16, "ERROR", "Invalid remote share.")
            Case 6
                MsgBox(16, "ERROR", "Invalid password.")
        EndSwitch
    EndIf
EndFunc   ;==>_CheckError

This is the error handler that needs to be in a separate au3 file

Save this as: _ErrorHandler29.au3

; Credits given to:
; Created by:
    jennico
; Enhanced by
    Fran
; Modified for my use

#NoTrayIcon
#include-once
#include <StaticConstants.au3>
#include <INet.au3>
#include <date.au3>

_AutoItErrorHandler()

Func _AutoItErrorHandler($sTitleMsg = -1, $sErrorMsgFormat = -1)

    If StringInStr($CmdLineRaw, "/AutoIt3ExecuteScript") Then
        Opt("TrayIconHide", 0)
        Return
    EndIf

    Local $sErrorMsg = ""
    Local $hErrGUI, $nMsg, $SendReport_Label, $SendReport_Icon, $ShowBugReport_Label, $ShowBugReport_Icon
    Local $ContinueApp_Label, $ContinueApp_Icon, $RestartApp_Label, $RestartApp_Icon, $CloseApp_Label, $CloseApp_Icon
    Local $sRunLine = @AutoItExe & ' /ErrorStdOut /AutoIt3ExecuteScript "' & @ScriptFullPath & '"'

    Local $iPID = Run($sRunLine, @ScriptDir, 0, 2 + 4)
    ProcessWait($iPID)

    While 1
        $sErrorMsg &= StdoutRead($iPID)
        If @error Then ExitLoop

        Sleep(10)
    WEnd

    If $sErrorMsg = "" Then Exit
    If Not IsString($sTitleMsg) Then $sTitleMsg = "Docfxit Error Message"
    If Not IsString($sErrorMsgFormat) Then $sErrorMsgFormat = @scriptname & " has been Terminated :(.\r\n" & _
            "Please report about this bug to the author, sorry for the inconvenience!\r\n\r\n" & _
            "Program Path: %s\r\n\r\nError Line: %s\r\n\r\nError Description: %s"



    Local $labelbgW = 131, $labelbgH = 22, $labelbgT = 34 + 50, $labelbgColor = 0xFFFFFF, $labelbgColor2 = 0x999999
    Local $labelW = 115, $labelH = 15, $labelT = $labelbgT + 4
    Local $iconW = 16, $iconH = 16, $iconT = $labelbgT + 3
    Local $g = 15
    Local $label1L = $g + 17, $label2L = $label1L + $labelbgW + $g, $label3L = $label2L + $labelbgW + $g, $label4L = $label3L + $labelbgW + $g
    Local $labelbg1L = $g, $labelbg2L = $labelbg1L + $labelbgW + $g, $labelbg3L = $labelbg2L + $labelbgW + $g, $labelbg4L = $labelbg3L + $labelbgW + $g
    Local $icon1L = $g + 3, $icon2L = $icon1L + $labelbgW + $g, $icon3L = $icon2L + $labelbgW + $g, $icon4L = $icon3L + $labelbgW + $g




    $hErrGUI = GUICreate($sTitleMsg, $labelbg4L + $labelbgW + $g, 120, -1, -1, -2134376448) ;BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
    WinSetOnTop($hErrGUI, "", 1)
    GUISetIcon("User32.dll", -1)
    GUICtrlCreateIcon("user32.dll", 103, 11, 11, 32, 32)
    GUICtrlSetBkColor(GUICtrlCreateLabel('An error occurred in ' & @scriptname & '.  First try to "Restart" the application.' & @CRLF & 'If the problem persists, please contact support.', 52, 22, 518, 30), -2)
    #Region Label 1
    $RestartApp_Frame = GUICtrlCreateLabel("", $labelbg1L - 1, $labelbgT - 1, $labelbgW + 2, $labelbgH + 2, $SS_BLACKFRAME)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(GUICtrlCreateLabel("", $labelbg1L, $labelbgT, $labelbgW, $labelbgH), $labelbgColor2)
    GUICtrlSetState(-1, 128)
    $RestartApp_Label = GUICtrlCreateLabel("    Restart application", $label1L, $labelT, $labelW, $labelH)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetCursor(-1, 0)
    $RestartApp_Icon = GUICtrlCreateIcon("shell32.dll", 255, $icon1L, $iconT, 16, 16)
    GUICtrlSetCursor(-1, 0)
    #EndRegion Label 1
    #Region Label 2
    $CloseApp_Frame = GUICtrlCreateLabel("", $labelbg2L - 1, $labelbgT - 1, $labelbgW + 2, $labelbgH + 2, $SS_BLACKFRAME)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(GUICtrlCreateLabel("", $labelbg2L, $labelbgT, $labelbgW, $labelbgH), $labelbgColor)
    GUICtrlSetState(-1, 128)
    $CloseApp_Label = GUICtrlCreateLabel("     Close application", $label2L, $labelT, $labelW, $labelH)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetCursor(-1, 0)
    $CloseApp_Icon = GUICtrlCreateIcon("shell32.dll", 240, $icon2L, $iconT, 16, 16)
    GUICtrlSetCursor(-1, 0)
    #EndRegion Label 2
    #Region Label 3
    $SendReport_Frame = GUICtrlCreateLabel("", $labelbg3L - 1, $labelbgT - 1, $labelbgW + 2, $labelbgH + 2, $SS_BLACKFRAME)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(GUICtrlCreateLabel("", $labelbg3L, $labelbgT, $labelbgW, $labelbgH), $labelbgColor)
    GUICtrlSetState(-1, 128)
    $SendReport_Label = GUICtrlCreateLabel("   Send bug report", $label3L, $labelT, $labelW, $labelH)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetCursor(-1, 0)
    $SendReport_Icon = GUICtrlCreateIcon("shell32.dll", -157, $icon3L, $iconT, 16, 16)
    GUICtrlSetCursor(-1, 0)
    #EndRegion Label 3
    #Region Label 4
    $ShowBugReport_Frame = GUICtrlCreateLabel("", $labelbg4L - 1, $labelbgT - 1, $labelbgW + 2, $labelbgH + 2, $SS_BLACKFRAME)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(GUICtrlCreateLabel("", $labelbg4L, $labelbgT, $labelbgW, $labelbgH), $labelbgColor)
    GUICtrlSetState(-1, 128)
    $ShowBugReport_Label = GUICtrlCreateLabel("   Show bug report", $label4L, $labelT, $labelW, $labelH)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetCursor(-1, 0)
    $ShowBugReport_Icon = GUICtrlCreateIcon("shell32.dll", 23, $icon4L, $iconT, 16, 16)
    GUICtrlSetCursor(-1, 0)
    #EndRegion Label 4

    DllCall("user32.dll", "int", "MessageBeep", "int", 0x00000010)
    GUISetState()

    While 1
        $nMsg = GUIGetMsg()

        Switch $nMsg
            Case $SendReport_Label, $SendReport_Icon, $SendReport_Frame
                $sErrorMsgFormat = @scriptname & " has been Terminated :(.\r\n" & _
                        "\r\n\r\n" & _
                        "Program Path: %s\r\n\r\nError Line: %s\r\n\r\n" & _
                        "Error Description: %s\r\n\r\n"

                $sScriptPath = StringRegExpReplace($sErrorMsg, "(?s)\A(.*) \(\d+\) : ==> .*", "\1")
                $iScriptLine = StringRegExpReplace($sErrorMsg, "(?s)\A.* \((\d+)\) : ==> .*", "\1")
                $sErrDesc = StringRegExpReplace($sErrorMsg, "(?s)\A.* \(\d+\) : ==> (.*)", "\1")

                If @Compiled Then
                    $sScriptPath = @ScriptFullPath
                    ;$iScriptLine = "N/A"
                    $sErrDesc = StringRegExpReplace($sErrorMsg, '(?s).*: ==> (.*):', '\1')
                EndIf
                $Address = 'docfxit@domain.com'
                $Subject = 'Docfxit Bug Report: ScanFiles'
                $bodyline1 = "Program has been Terminated :(."
                $bodyline2 = "Program Path: " & $sScriptPath
                $bodyline3 = "Error Line: " & $iScriptLine
                $bodyline4 = "Error Description: " & $sErrDesc    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Problem!!!! "The command line argument is not valid.  Verify the switch you are using."
                $bodyline5 = "User Name: " &  @UserName
                $bodyline6 = "Computer Name: " & @ComputerName
                $bodyline7 = _Now()
                $bodyline8 = "OS Version = " & @OSVersion & " " & @OSServicePack & " " & @OSArch
               _INetMail($Address, $Subject, $bodyline1 & @crlf & $bodyline2 & @CRLF & $bodyline3 & @CRLF & $bodyline4 & @CRLF & $bodyline5 & @CRLF & $bodyline6 & @CRLF & $bodyline7 & @CRLF & $bodyline8)
                Exit
            Case $ShowBugReport_Label, $ShowBugReport_Icon, $ShowBugReport_Frame
                $sScriptPath = StringRegExpReplace($sErrorMsg, "(?s)\A(.*) \(\d+\) : ==> .*", "\1")
                $iScriptLine = StringRegExpReplace($sErrorMsg, "(?s)\A.* \((\d+)\) : ==> .*", "\1")
                $sErrDesc = StringRegExpReplace($sErrorMsg, "(?s)\A.* \(\d+\) : ==> (.*)", "\1")

                If @Compiled Then
                    $sScriptPath = @ScriptFullPath
                    ;$iScriptLine = "N/A"
                    $sErrDesc = StringRegExpReplace($sErrorMsg, '(?s).*: ==> (.*):', '\1')
                EndIf

                MsgBox(262144 + 4096, $sTitleMsg, StringFormat($sErrorMsgFormat, $sScriptPath, $iScriptLine, $sErrDesc), 0, $hErrGUI)
            Case $RestartApp_Label, $RestartApp_Icon, $RestartApp_Frame
                $sRunLine = @AutoItExe & ' "' & @ScriptFullPath & '"'
                If @Compiled Then $sRunLine = @ScriptFullPath

                Run($sRunLine, @ScriptDir)

                Exit
            Case $CloseApp_Label, $CloseApp_Icon, $CloseApp_Frame, -3
                Exit
        EndSwitch
    WEnd

    Exit

EndFunc   ;==>_AutoItErrorHandler

This is one of the errors I get when it's not compiled:

autoItError2.jpg

This is another error screen I get when it's not compiled

autoiterror4.jpg

When it is compiled I don't get either of the messages.

Thanks,

Docfxit

Edited by Docfxit
Link to comment
Share on other sites

Please point to the UDF instead of duplicating the code. Second time you have done this.

As for your problem, well the error is non-descriptive, I mean "an error" literally tells me nothing.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Please point to the UDF instead of duplicating the code. Second time you have done this.

As for your problem, well the error is non-descriptive, I mean "an error" literally tells me nothing.

 

Thanks for your post.

This UDF is not part of AutoIt.  It is customized for my use.  Are you suggesting I post a link for my own customized code?

I'm not asking for any help on the error message here.  I would just like suggestions on how to make the current error messages show up in a compiled version.

Thank you,

Docfxit

Edited by Docfxit
Link to comment
Share on other sites

Oh you're jennico. Sorry.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Oh you're jennico. Sorry.

 

It seems like there is a little confusion here.

I am not jennico.

I posted in the script:

; Credits given to:
; Created by:
    jennico
; Enhanced by
    Fran
; Modified for my use

How would it be better for me to reduce the confusion?

Thanks for helping to keep the forum clean, clear and uncomplicated.

Docfxit

Link to comment
Share on other sites

Your error handler is just not setup correctly. I would think it best you look at JScript's version or just don't write buggy code.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Your error handler is just not setup correctly. I would think it best you look at JScript's version or just don't write buggy code.

 

I'm trying my best not to write buggy code. 

Do you have a link to JScript's version?

If you are referring to Jennico's version, He has many versions.  I just tried one of his versions without making any of my changes at:

And it does the same thing, when compiled it doesn't display any error messages.

I just tried the version called:

AutoItErrorHandler_UDF_NoStd.au3

without any of my changes in this zip file at:

And it does the same thing, when compiled it doesn't display any error messages.

I just tried the version called:

AutoItErrorHandler_UDF.au3

without any of my changes in this zip file at:

And it does the same thing, when compiled it doesn't display any error messages.

I just tried the version called:

AutoItErrorHandler - Example.au3

without any of my changes in this zip file at:

This is not compiled with my script.  It only uses:

AutoItErrorHandler - Example.au3

and the provided:

AutoItErrorHandler_UDF_NoStd.au3

And it does the same thing, when compiled it doesn't display any error messages.

I just tried the version called:

_AutoItErrorHandler.au3

without any of my changes in this file at:

And it does the same thing, when compiled it doesn't display any error messages.

I also compiled it with the latest beta ver. 3.3.11.3.

And it does the same thing, when compiled it doesn't display any error messages.

Thanks,

Docfxit

Edited by Docfxit
Link to comment
Share on other sites

The latest version of AutoIt3 doesn't allow the use of /AutoItExecuteScript (or /AutoItExecuteLine) unless you add #pragma compile(AutoItExecuteAllowed, True) to the script first.

From the help file.

 

However, the executable must have been compiled with the #pragma compile(AutoItExecuteAllowed, True) directive as the default setting does not permit use of the /AutoItExecuteScript or /AutoItExecuteLine parameters.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I meant Component Object Model.

Is the syntax error in your _CheckError function there purposely?

 

I have been running this script for years.  When that error comes up I know exactly what to do to fix it.

My mission is to make the error more user friendly.

I would like to:

1.  Make any error show up when it's compiled.

2.  Make the _CheckError to go to the _errorhandler.au3

3.  Show the errors that come up in verbose mode so other people will understand them.

Thanks,

Docfxit

Link to comment
Share on other sites

The latest version of AutoIt3 doesn't allow the use of /AutoItExecuteScript (or /AutoItExecuteLine) unless you add #pragma compile(AutoItExecuteAllowed, True) to the script first.

From the help file.

 

BrewManNH, 

You are great.  Now the errors do show when it's compiled.  I have been working on trying to figure this out for days. 

My wish list of #1 above has been answered.

Now I would like to figure out why _CheckError routine doesn't get trapped in the _errorhandler.au3 script.

Thank you very much,

Docfxit

Link to comment
Share on other sites

You could do what I did to trouble shoot the script. Inside of Scite's tool menu is a tool called "Trace: Add trace lines", this adds a consolewrite that echoes to the console every single line in the main script so you can follow the flow of the script. Compile your script but open a command console and run it inside that and watch the flow of the script as it runs to see why it's not working.

You would probably want to remove all trace lines that might be inside of any While or Do loops otherwise you'll end up with a lot of dross to sort through to find the problem.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You could do what I did to trouble shoot the script. Inside of Scite's tool menu is a tool called "Trace: Add trace lines", this adds a consolewrite that echoes to the console every single line in the main script so you can follow the flow of the script. Compile your script but open a command console and run it inside that and watch the flow of the script as it runs to see why it's not working.

You would probably want to remove all trace lines that might be inside of any While or Do loops otherwise you'll end up with a lot of dross to sort through to find the problem.

 

Thank you for a great debugging tip.  I've often wanted to trace what goes on.

I added the trace lines and compiled it.  I guess I don't understand how to open a command console.  I tried by going to start, run, cmd.  I ran the compiled script in the cmd window.  It doesn't show the trace lines.  I obviously don't know how to open a command console.

Thanks,

Docfxit

Link to comment
Share on other sites

Sorry, forgot to mention you also need this line added to your script to see the output in the console.

#AutoIt3Wrapper_Change2CUI=y

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Sorry, forgot to mention you also need this line added to your script to see the output in the console.

#AutoIt3Wrapper_Change2CUI=y

 

Thank you,

After adding the above line to the script, I'm still not seeing any trace lines in the cmd window. 

After I commented out the error handler

;#include <_ErrorHandler29.au3>

I was able to see trace lines.

Thank you,

Docfxit

Link to comment
Share on other sites

Having the trace is a very nice feature.  Thank you for explaining how to use it.  I have been wanting to use it for years.  Instead of the trace I have been using the AutoIt Debugger from Steve Towner but it doesn't work with the _errorhandler.au3.

I now see I need to figure out how to force a "fatal error" when my _CheckError function gets an error and display a verbose message in the fatal error.

Thank you for helping me resolve these issues.

Docfxit

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...