Jump to content

How do I track down an error visible only in compiled exe?

Recommended Posts

My script has this directive (#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6) at the top.  When I run the script from SciTE the results are what I expect and no errors are generated.  When I run the compiled executable I still get what I expect results-wise, but at the very end an AutoIt Error appears: "Error: Variable used without being declared". It cites a line number far out of range of my actual code, though perhaps it is referring to an included UDF.

What can I do to more accurately simulate running the exe in SciTE so I can track down the undeclared variable? I suspect it's a UDF because I've added a couple recently.

Thank you.

Edited by timmy2
make title more specific
Link to post
Share on other sites

Use Au3Stripper with option /mo.
"That just merges the Include files into the source and strips the Comments. This is similar to aut2exe and helps finding the errorline."

My UDFs and Tutorials:


Active Directory (NEW 2021-06-05 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version - Download
Outlook Tools (2019-07-22 - Version - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki
WebDriver - Wiki


Link to post
Share on other sites
  • Moderators


Or you could post your code so we can run it and see if we can reproduce the problem.


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By argumentum
      This is a UDF to handle the AutoIt Error msgbox when our awesome code goes 
      I've been using trancexx's code for the longest time and since I iron some wrinkles in my ( personal use ) UDF, decided to organize it in a dignifying way and post it.
      The ZIP with the code is in the downloads area.
      I'm posting this because most other handlers use /ErrorStdOut to catch errors and they are not that common, for us great coders 
      So makes little sense to me to run 2 EXEs for something unlikely to happen. No one made a UDF of this, so, I did.
      oh, ..there are things where this will be of no use, say, infinite recursion or what not, so, if the the AutoIt Error msgbox was to popup then this UDF should do it.
      ...let me know if you liked it, or post your views to better it.
      There is also an EventViewer_GetMyEntries() down this post that may come in handy.
    • By argumentum
      #NoTrayIcon If @Compiled Then Exit MsgBox(262144, @ScriptName, "run this test from SciTE" & @CR & "this is just a test", 5) #include <WinAPI.au3> ; for _WinAPI_FindWindow #include <Misc.au3> ; for _IsPressed If StringInStr($CmdLineRaw, "DoACrash") Then DoACrash() Func DoACrash() Local $a = "caca" $a[1] = "more caca" EndFunc ;==>DoACrash Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" DoACrash') ; to create the initial crash catchTheCrash() Func catchTheCrash() AutoItWinSetTitle("if this window not found, then, a crash catcher is wanted ???") Local $hDLL = DllOpen("user32.dll") Local $w, $t = TimerInit() While 1 ToolTip("press and hold ""ESC"" to exit." & @CR & "loop time: " & Round(TimerDiff($t)) & " mSec.") $t = TimerInit() Sleep(20) If _IsPressed("1B", $hDLL) Then Exit 0 ; ESC key $w = _WinAPI_FindWindow("#32770", "AutoIt Error") ; very fast, does not affect CPU much If $w Then WinSetState($w, "", @SW_HIDE) ; all these are slow. Is there a faster way to not show the MsgBox ? ConsoleWrite("--- " & @MIN & ":" & @SEC & "." & @MSEC & @CRLF & _ ControlGetText("AutoIt Error", "", "Static2") & @CRLF) WinClose($w) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" DoACrash') ; ..to keep on crashing ;) EndIf WEnd EndFunc ;==>catchTheCrash is there a faster way to get the info. and close the MsgBox ?
  • Create New...