Jump to content

Strange ERROR box


Recommended Posts

Hi Guys,

I have a very, very, very long script.

Occasionally, it throws up a strange error dialogue box.
It's a standard Windows dialogue box, similar to that generated with the MsgBox ( flag, "title", "text" [, timeout = 0 [, hwnd]] ) command.

However,  it shows no line number, and the window just says "Error". There is a single Ok button, which when clicked causes the script to exit.

It's not part of my coding, so I am guessing that it is being generated by the AutoIT interpreter, but I have no idea why.

The script is hundreds of lines long, so it's not something which I can realistically trace without a line number.

I do have other scripts which also run 24/7, and none of them have this problem.

Any ideas as to why such an unknown error box gets generated.

That would at least give me a starting point.

Many thanks,
Pete



 

Link to comment
Share on other sites

Put some log into your script to know where the error occurs.  Asking such a question is pretty much impossible to answer unless we know what the statement (and its surroundings) is.

Then create a small reproducible and runnable script that we can test ourselves. 

Edited by Nine
Link to comment
Share on other sites

2 hours ago, Dan_555 said:

I sometime place either a messagebox or console write lines in my script, for debugging purposes [...]

@Dan_555 I do same during the debugging phase, using an abbreviation in Scite Editor. In fact there are only 2 abbreviations (until now) in my abbrev.properties file :

1) 1st abbreviation : err

err=If @error Then ConsoleWrite("Line #" & @ScriptLineNumber & "   @error = " & @error & @crlf)\n

Typing err then Ctrl-b will replace the letters err with the following line in the script :

If @error Then ConsoleWrite("Line #" & @ScriptLineNumber & "   @error = " & @error & @crlf)

2) 2nd abbreviation : b

b=Local Static $iCounter = 0\n$iCounter += 1\nConsoleWrite("$iCounter = " & $iCounter & @crlf)\n

Typing b then Ctrl-b will replace the letter b with the following 3 lines in the script :

Local Static $iCounter = 0
$iCounter += 1
ConsoleWrite("$iCounter = " & $iCounter & @crlf)

These 3 lines are often useful for me (used "as is" or as a frame) inside a function during the debugging phase. I choosed "b" because it's the easiest abbreviation to type : as you already got a finger placed on the b key, then you just need a finger from the other hand to be placed on the Ctrl key

Guess  which abbreviation I use most :D

Link to comment
Share on other sites

Which UDFs do you #include in your script?
Maybe there is a debugging MsgBox left/forgotten.
 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators
On 12/27/2022 at 2:09 PM, pete_wilde said:

The script is hundreds of lines long, so it's not something which I can realistically trace without a line number.

The only reason for this is A: It is not your script but one you copied without knowing quite what it does, or B: your script that includes zero error-checking. Either way, as suggested above, you need to put some effort into going through the script line by line so you can properly add error-checking and logging. The alternative is to continually be at a loss like this whenever something unexpected happens with it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

×
×
  • Create New...