Jump to content
Sign in to follow this  
seadoggie01

(Solved) Include a3x Issues

Recommended Posts

When compiling a file to a3x I kept running into issues... I was getting messages that were saying that I was attempting to redeclare a constant. The strange thing was that everything worked fine with the au3 version. So I cut out all the lines of code and ended up with these two files that are the base of the issue.

Test_1.au3

#include <Array.au3>
#include <Test_2.a3x>

ConsoleWrite("Test_1" & @CRLF)

Test_2.a3x

#AutoIt3Wrapper_Outfile_type=a3x

#include <GuiTreeView.au3>

Msgbox(0, "A3X", "I ran!")

When I run Test_1.au3 (not compile) I get this error: <FullFilePath> (3830) : ==> Can not redeclare a constant.:

If I remove either of the includes, everything works great. Anybody have any clues as to what could be happening here?

 

(Btw... normally including Excel and GuiTreeView works great and these UDF are amazing! Not dissing the authors at all :) )

Running Windows 10 x64, Full version of AutoIt and SciTE, default compiling to x64, but x32 doesn't seem to matter, I tried

 

Edit: Excel includes Array.au3, replacing Excel with Array.au3 continues the issue

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

Found it... also, can I get a big F in chat?

 

Including files in the a3x caused a chain reaction of includes... resulting in the AutoItConstants.au3 file to be included in both files. When the resulting program ran, it found the constants double included and (of course) errored. I think i'll need to use Tidy or Stripper settings to replace constant variables with actual values. Leaving this here for anyone else that stumbles across this :D


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

In current release, AutoItConstants.au3 first line is #include-once so it shouldn't be a problem if it gets included more than once.  Proof:

#include <AutoItConstants.au3>
#include <AutoItConstants.au3>
#include <AutoItConstants.au3>
#include <AutoItConstants.au3>

MsgBox(0, "", "")

Are you running the latest release?


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)

Share this post


Link to post
Share on other sites

Yes (I'm on v3.3.14.5) ... it's because I was including a separate a3x into a au3 file and they don't check between them if the other has something included... like this :)

File 1 (compiles to exe)

#include <Array.au3>
#include <File2.a3x>

ConsoleWrite("I'm au3 or exe!" & @CRLF)

File 2 (compiles to a3x)

#AutoIt3Wrapper_Outfile_type=a3x

#include <Array.au3>

ConsoleWrite("I'm a3x" & @CRLF)

It will give you an error about having duplicate functions or constants... I think because the check is made before inserting the second file... or because it would need to be recursive... I'm not sure

Edited by seadoggie01
Adding AutoIt version

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


Link to post
Share on other sites

I never imagined you could have a mixed-format ( .au3 + a3x) being run or built.


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)

Share this post


Link to post
Share on other sites
13 hours ago, jchd said:

I never imagined you could have a mixed-format ( .au3 + a3x) being run or built.

I do that all the time :)

Problem is when the same file gets included twice in different formats. You won't see the problem during the build, only at runtime.

 


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

FMI, what is the use case for doing so?


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)

Share this post


Link to post
Share on other sites

How you bulid them?

Could you make an example reproducer? 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) *

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2020-11-20

Share this post


Link to post
Share on other sites
41 minutes ago, jchd said:

FMI, what is the use case for doing so?

The answer is simple enough.  The obsession to keep code private.  Keep includes in standard .au3 and compile own code to .a3x

 

Problem starts when you compile includes. Like GUIConstants


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

Hi,

I can see why the problem arises - and I cannot really see how to avoid it without user input.  When you compile a script into an .a3x file all of the #include files are expanded and so there is no indication to any subsequent run or compilation which includes that file that these #include files are there as there are no "#include-once" lines to find.

As suggested above, the only solution I can see would be to get the .a3x file running with the necessary includes and then compile it with all the includes commented out - you will need to disable Au3Check to do this. Then make sure that the script in which the .a3x file is an  #include has those necessary includes within it before the .a3x file itself.

But given that an .a3x file is as easy to decompile as any other compiled AutoIt file I have to question whether the faff involved in doing all of the above is actually worth it.

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

 

Share this post


Link to post
Share on other sites
2 minutes ago, Melba23 said:

I have to question whether the faff involved in doing all of the above is actually worth it.

I too have hard time seeing the light out of all this.


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)

Share this post


Link to post
Share on other sites

I was trying to use it because the anti-virus here at work picks up any 32bit scripts I write. I wanted to control a 32bit application with a listview, however, so I was trying this...

Main File_x64.exe or au3

       FileInstall: ProgramControler_x32.a3x

Instead I found I can do this much easier...

Wrapper_x64.exe

     FileInstall: AutoIt_x32.exe

    FileInstall: MainApplication.au3

 

I like the idea of open source, so compiling to a3x had nothing to do with hiding code, I don't care who reads my stuff, I just wish them luck :D

Edit: The reason I tried a3x originally is because of this topic... 

 

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...