Jump to content

No Runtime errors, but compiled EXE gives error


Recommended Posts

I can run my script in the editor and it works great, however when I compile the EXE and try to run it, I get an error of a line number that doesn't exist (Like 9870) in my script and says "Variable Used before declaration"!

How do I track down something that isn't causing an error at runtime?

Edited by Patchworks
Link to comment
Share on other sites

Hmm, maybe post your script and someone could look it over and double check your work? The fact its not getting an error during executing the script is weird though.

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

I once had a similar error with a script that i couldn't track down until I used the Tools menu option of Trace Add Trace Lines, which puts a consolewrite for every line in the script, then I compiled it as a CUI app so that it would write to the console when I ran the .exe file. I finally was able to trace the problem to the line by seeing where it crashed the script.

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

  • 3 weeks later...

Thanks guys for all the help! I wanted to report back so other wouldn't waste hours of time hunting this stupid problem!

I had place the local declaration in an if statement!

Basically it was not declaring the variable but the program would compile without an error but at runtime it would cause an error if condition wasn't right!

If Condition
Local Variable
elseif
Endif
Variable = 1
Link to comment
Share on other sites

Just for your info about error line number:

In compiled EXE there is script bundled also with all include files and stripped comments.

That's why your line number was diferent from your sources.

You can see this final AU3 source with all include files and stripped comments by using

#AutoIt3Wrapper_run_obfuscator=y

#Obfuscator_parameters=/striponly

There is created script_obfuscated.au3 before compilation from Scite4Autoi3.

Edited by Zedna
Link to comment
Share on other sites

  • 3 months later...

Hi guys,

I thought I can ask here instead of opening a new thread...

I have the same problem. I'm working on quite a big project and I need to be able to match the error line number returned by the EXE file when error occurs.

I realize the final script is a combination of all the includes etc. and what I need to know is:

Is there any way I can get the final source code with all the includes added, just the way it is composed by the Aut2exe?

I don't want to obfuscate the code at all, because the space gained is not worth the complications this can bring up.

I tried to run the obfuscator with the parameters shown in the above post, but it strips the unused functions and variables and I don't want that.

I also tried to run it with /SF=0 /SV=0 /CV=0 /CF=0 /CS=0 /CN=0, but is says there is nothing to do and only copies the original script, without inserting all the includes.

In other words, I'm looking for a way to have the source of the EXE saved during the compilation process (without any obfuscation) so when I get an error message from the EXE, I can just open this source, match the line number and see where the error came from.

I hope this makes sense to you... :)

Link to comment
Share on other sites

  • Moderators

dv8,

I don't want to obfuscate the code at all, because the space gained is not worth the complications this can bring up

Using Obfuscator with /STRIPONLY causes no complications as it does not change any of the variable or function names and so does not run into any problems with Execute, Adlib, etc. I would try using it on a copy of your script to see if you can then identify the line(s) causing the problem. :)

Incidentally, why would you not want to strip out the unused functions and variables from your executable? Certain #include files are very large and you can get significant size reductions by removing the items that are not needed. Remember that your original script is not touched at all by Obfuscator - it produces its own file to be compiled by Aut2Exe. ;)

M23

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:

Spoiler

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 comment
Share on other sites

As I stated above, I already tried that...

I'm getting:

-#### Obfuscator Found 10 Error(s)!!!! This means your script could have problems running properly. ####

And some of them are:

-### StripOnly/StripFunc Error: Found ObjEvent() statement using unsolvable Func, which will/could lead to removal of Funcs that are used by this Function.

>### current Func: _IEErrorHandlerRegister

...

-### StripOnly/StripFunc Error: Found Call() statement using unsolvable Func, which will/could lead to removal of Funcs that are used by this Function.

>### current Func: _TrayNotifyIcon

I'm not able to extensively test the program, because it is huge and I'm not willing to risk releasing it to the public, knowing that thee are 10 potential problems lurking in there...

That's why I don't need the obfuscation. The size of the executable is not an issue at all. The execution speed is also not an issue.

I wonder why there is no such option in the compiler, to save the whole source as the obfuscator does, before the compilation process starts.

What good is an error report with a line number, that you can not trace in your files?

Link to comment
Share on other sites

  • Moderators

dv8,

Have you tried disregarding the posted "errors" and compiling the script regardless? Often these errors will only cause problems if you actually "obfuscate" the script and change the function and variable names - that is why it they say "will/could". ;)

Why not give it a try? :)

M23

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:

Spoiler

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 comment
Share on other sites

Also, I have another silly question. :)

Where should the obfuscator.exe be placed in order for the AutoIt3Wrapper to be able to find and run it. I tried putting it in the same folder as AutoIt3Wrapper (which is ...AutoitExtras), but it is not running.

I'm using the PSPad editor.

I have these two lins in the script:

#AutoIt3Wrapper_Run_Obfuscator=Y

#Obfuscator_Parameters= /STRIPONLY

And I'm compiling it through PSPad using the following command:

AutoIt3Wrapper.exe /in myscript.au3

Link to comment
Share on other sites

  • Moderators

dv8,

Are you sure these reported errors are not really a potential problems

No I am not sure - and that is why I said "Often these errors will only cause problems if you actually "obfuscate" the script". ;)

But I assume you are going to test the executable before releasing it (at least I hope so!), so what do you lose by at least trying to compile? Note which parts of the script are flagged as possible errors (you mention only 10) and make sure that those sections do actually work before going any further. ;)

By the way, I take it you have read the Obfuscator thread carefully and that you understand why the tool gives you these "errors"? And why it is impossible to completely eradicate them? And also how you can get around some of them? :)

M23

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:

Spoiler

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 comment
Share on other sites

Try running the obfuscated script through AU3Check and see if any of your functions are missing after you've used /striponly on the original.

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

OK,

although I ran into some issues, there is a progress and I actually managed to match the error line numbers in the source and the error report from the EXE.

If anyone else bumps into this problem, I would suggest you also take a look at this thread:

There is a good explanation (and a way to fix it) on why your line numbers may not match...

Thank you for your help guys!

EDIT: Now I need to test if the Obfuscator has messed anything... Tomorrow will be another long day for me... :)

Edited by dv8
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...