Jump to content

Recommended Posts

Posted

Hi all,

I have compiled a script to exe (using aut2exe) and delivered it to another machine, which does not have AutoIt installed. There, it does not run, but tells me that an undefined variable is used.

I assume that the files referred to by #include are not embedded in the exe.

How can I make sure the included files are available, when I deploy the exe to another machine?

Thanks in advance for your helpful hints!

  • Developers
Posted

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

Everything will be included that is defined in your main script, so there must be somewhere a logic issue. ;) 

Show you script and the error you get so we can help checking it.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

On the developer machine, it runs smoothly. That's why I guess the reason might be something missing in the compiled file, that is automatically found on the developer machine.

Here's the script.

zoom-shot-man.au3

  • Moderators
Posted

Sonjoe,

Running Au3Check on your script produced the following error and warnings (plus another 38 warnings about declaring Global variables within a function):

>Running AU3Check (3.3.15.5)  params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w- 7  from:M:\Program\AutoIt3  input:M:\Downloads\zoom-shot-man.au3
"M:\Downloads\zoom-shot-man.au3"(221,65) : warning: $PageDelayDelay: possibly used before declaration.
        RegWrite ($RegKey, $RegValPageDelay, "REG_SZ", $PageDelayDelay)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"M:\Downloads\zoom-shot-man.au3"(390,49) : error: syntax error
    GUICtrlSetState ($AutoResetCheckbox, $AutoReset:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"M:\Downloads\zoom-shot-man.au3"(480,40) : warning: $PicViewerPID possibly not declared/created yet
        $PicViewerPID = Run ($PicViewerProg1)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"M:\Downloads\zoom-shot-man.au3"(519,33) : warning: $FileNameFix: possibly used before declaration.
    Local $FileName = $FileNameFix &
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"M:\Downloads\zoom-shot-man.au3"(221,65) : error: $PageDelayDelay: undeclared global variable.
        RegWrite ($RegKey, $RegValPageDelay, "REG_SZ", $PageDelayDelay)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
M:\Downloads\zoom-shot-man.au3 - 2 error(s), 41 warning(s)
!>10:43:25 AU3Check ended. Press F4 to jump to next error.rc:2
+>10:43:25 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.652

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

 

Posted

Thanks a lot!

  •  Au3Check is actually new to me.
  • And I did not now that it's forbidden to define global variables in a function. I thought that, after it worked well on the developer machine, it would be ok.
  • And it looks like this explains why the error message was "Variable used without being declared.". Nevertheless, I'm surprised that it works on the developer machine, if it's not allowed.

 

Posted

It isn't forbidden, just bad practice since it's prone to the kind of error you've experienced.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

Also when it gets time to debug a script after a few months (or someone else may try to modify the code), it is quite a nightmare to follow global variables declare everywhere in the code.  The best practice is to declare ALL global variables at the very beginning of the code.

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
×
×
  • Create New...