Jump to content

Include script updates applied to released projects


Recommended Posts

Hi, 

I hope I've submitted my question in the right place.. Most times I find what I need from searches and the help file, but this time I can't find it. 

So I have 30+ released files. In order to keep the code more organised, I've added my own script(s) to the includes folder, called "Functions.au3". This is working and of course, I only need to update any changes in 1 place. 

Now, my problem as follows. 
I had to update few things in the "Functions.au3" included file. In order to take the changes to affect, I have to go through all my projects, and re-compile them. 
Due to recent requirements, I know, that functions in this included "Functions.au3" file will need to be changed in the next days/weeks. 

My question is, do you know how to make the compiled files to use the "Functions.au3" file without being "cooked" into the output .exe files? 
My hope is to reference the "Functions.au3" file from the .exe file, but when I update anything in the "Functions.au3" file, it would be used without the need of re-compile. 

Your suggestion and guidance is much appreciated.

Many thanks
A

Link to comment
Share on other sites

Link to comment
Share on other sites

19 minutes ago, Nine said:

This is not trivial and it would make your project way more complicated for a small problem. Just create a script that will recompile all 30+ exe altogether...

Hi Nine, 

Thanks for your suggestion. 
It would work if all projects using the "Functions.au3" included file. The released projects also containing folders where the output files will be placed. 

Link to comment
Share on other sites

1 hour ago, Nine said:

This is not trivial...

Is it even feasible?  (Without remaking the .exe in some fashion).

Broadly speaking, what approach(es) did you have in mind, even if too complicated for this scenario?

Just curious.

Code hard, but don’t hard code...

Link to comment
Share on other sites

@JockoDundee There is a number of ways.  One is to create a functions server and clients could request a desired function thru an IPC.  Another option would be to extract the function from the "included" file, create a new script on the fly and run that newly created file.  Return values could be read through the stream for example or by other means.  There is probably other solutions more or less complicated, but those are the ones that came to me first.

@Fehera I did not understand your last post.  You seemed reluctant to batch the creation of all .exe but I do not see clearly the reasons.  

Link to comment
Share on other sites

Best would be to create a make/cmake to automate rebuilds when a user UDF is changed.

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)

Link to comment
Share on other sites

1 hour ago, Nine said:

I did not understand your last post.  You seemed reluctant to batch the creation of all .exe but I do not see clearly the reasons.  

You were suggesting to "Just create a script that will recompile all 30+ exe altogether". This solution would work if I want to re-compile all projects. 
In my initial question I tried to keep my problem simple. I see now, that you've provided a viable solution which probably will work. Although, I hope there will be other solutions, where the included files not "baked" into the compiled exe files. 

Link to comment
Share on other sites

45 minutes ago, Fehera said:

Although, I hope there will be other solutions, where the included files not "baked" into the compiled exe files. 

If you don’t mind uncompiled au3 files on the machine, why not just run everything thru the interpreter?

Code hard, but don’t hard code...

Link to comment
Share on other sites

1 hour ago, JockoDundee said:

If you don’t mind uncompiled au3 files on the machine, why not just run everything thru the interpreter?

The compiled projects being executed by another systems, where the files must be executable which is limited to ".exe" files. 

Link to comment
Share on other sites

26 minutes ago, Fehera said:

The compiled projects being executed by another systems, where the files must be executable which is limited to ".exe" files. 

The file that would be run is autoit3.exe, which is an .exe, it would just have a command line argument of yourprog.au3.

You would put any necessary #includes in the same folder as where your Function.au3 was going to be placed, and path out to them in yourprog.au3.

Not only that, you don’t even need AutoIt.exe, you can use yourprog.exe as the interpreter of yourprog.au3, since every .au3 compiled with the #pragma compile(AutoItExecuteAllowed, True) is a mini-interpreter.  See here for the syntax needed to call it.

So to recap, with this method, your function.au3 will not be “cooked into” the .exe, but rather the .exe will act as an interpreter of ALL your .au3 (if you choose not to use autoit3.exe directly).

The upside is you will be able to change any .au3 on the fly without recompilation.
The downside is you will need yourprog.au3 and any other UDFs to be local on the machine.

Questions?

 

 

 

Code hard, but don’t hard code...

Link to comment
Share on other sites

1 hour ago, JockoDundee said:

The file that would be run is autoit3.exe, which is an .exe, it would just have a command line argument of yourprog.au3.

You would put any necessary #includes in the same folder as where your Function.au3 was going to be placed, and path out to them in yourprog.au3.

Not only that, you don’t even need AutoIt.exe, you can use yourprog.exe as the interpreter of yourprog.au3, since every .au3 compiled with the #pragma compile(AutoItExecuteAllowed, True) is a mini-interpreter.  See here for the syntax needed to call it.

So to recap, with this method, your function.au3 will not be “cooked into” the .exe, but rather the .exe will act as an interpreter of ALL your .au3 (if you choose not to use autoit3.exe directly).

The upside is you will be able to change any .au3 on the fly without recompilation.
The downside is you will need yourprog.au3 and any other UDFs to be local on the machine.

Questions?

 

 

 

@JockoDundee I think I understand your approach. Let me play around with your suggestion and study the link (https://www.autoitscript.com/autoit3/docs/intro/running.htm) you referenced. I prefer to learn by trial & error..
 

Quote

The downside is you will need yourprog.au3 and any other UDFs to be local on the machine.

Could you please elaborate on this?

Many thanks
A

 

Link to comment
Share on other sites

Look at posibility of compilation to A3X (compiled format without runtime module).

So maybe you could compile your functions/includes to A3X format and then in main script use #include <functions.a3x>

 

I'm not 100% sure if it would work this way but it was disccused here already, so try to search here for A3X compile & include ...

 

EDIT:

According 

https://www.autoitscript.com/trac/autoit/ticket/383

it should work since the version: 3.3.9.5

Edited by Zedna
Link to comment
Share on other sites

Yes it is working but you need to add in main script:

#AutoIt3Wrapper_Run_AU3Check=n

However the main script needs to be recompiled after changes in Functions.a3x.  So it doesn't change OP issue.

Edited by Nine
Link to comment
Share on other sites

Here is the method:

Input:

1) yourprog.au3  - This is the source containing the main of the program - it is executed dynamically as is, (it is also compiled to .exe to provide a launcher)

2) staticUDFs.au3  - This is the source containing any UDFs (or #includes to ext UDFs), except for those in Functions.au3, it is compiled to .a3x and executed statically.

3) Functions.au3 - This is the source containing the UDFs that the OP wants to change on the fly without recompilation.

Process Initial Setup:

1) Compile staticUDFs.au3 to staticUDFs.a3x

2) Compile yourprog.au3 to yourprog.exe

3) Transfer yourprog.exe, yourprog.au3, staticUDFs.a3x and Functions.au3 to target env

4) Change startup command to: yourprog.exe /AutoIt3ExecuteScript yourprog.au3

Pay attention to file extensions, its tricky.

Basically, your are using your yourprog.exe only as a dynamic launcher for yourprog.au3.  You are using staticUDFs.au3 as a compiled container for all UDFs, except for Functions.au3, so that you don't have to bring all their source files to the target.

This should give you the ability to change Functions.au3 and yourprog.au3 on the fly without recompilation.

Here are my test files:

staticUDFs.au3 Functions.au3

yourprog.au3

Edited by JockoDundee

Code hard, but don’t hard code...

Link to comment
Share on other sites

I am not sure I am following you there Jocko.  If you send the uncompiled files (main and functions) to the target environment, why not use simply send AutoIt3.exe to start main script .au3 ?  I mean why compiling main prog if you can start the script with the original AutoIt3.exe ?

btw : you need to add #pragma compile(AutoItExecuteAllowed, true)

Edited by Nine
Link to comment
Share on other sites

11 minutes ago, Nine said:

I am not sure I am following you there Jocko.

Then you're not following the thread, as I already said you could run AutoIt3.exe instead of yourprog.exe. 

However, you could also use yourprog.exe to launch, if perhaps there is an issue with the AutoIt executable.  Suggesting it because he's familiar with that .exe distribution.  If I were doing it, I would use AutoIt3.exe, maybe rename it if i didn't want to advertise.  Plus there is the perverse thrill in having the static version of a program call the dynamic one :)

18 minutes ago, Nine said:

btw : you need to add #pragma compile(AutoItExecuteAllowed, true)

no, I already put it in yourprog.au3 when i published, look in the file above.

Code hard, but don’t hard code...

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...