Jump to content
pedrit0

keep '#include' au3 file editable after compiling main exe

Recommended Posts

pedrit0

Hi all.

I have created an external au3 (a library of functions and vars) that is #included in a main script that i must compile.

I wish that the content of the library is not merged with the main script when compiling.

My goal is to keep the ability to modify the library even after the main exe is compiled and that these changes are effective when executing the exe.

I guess this is not possible using the standard #include method.

Is there a way to do that ?

thx a lot :-)

Edited by pedrit0

Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
Jfish

I am having trouble understanding why you would need to do that?  If you want to read dynamic data into your application you can use a file.  You can also shellexecute au3 source files against the autoit exe.  Perhaps you can explain what you are trying to specifically accomplish for a more precise answer?


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
pedrit0

Hi Jfish

I have 2 files:

- mainscript.au3

- FunctionLibrary.au3 that contains the functions to be used by mainscript

I want to compile mainscript.au3 but not FunctionLibrary.au3 because i want to be able to modify it later without having to recompile the mainscript.

I know this behavior is not possible with the #include method that would merge the library to the mainscript during compilation. Which means that the external library would become useless.

So I am looking for another method.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
Jfish

Yes, that much is clear.   But why do you need to modify the functions post-compiling of the exe without including them in the compiled code?  What specifically are you trying to accomplish?  There may be a better way.   


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
pedrit0
29 minutes ago, pedrit0 said:

because i want to be able to modify it later without having to recompile the mainscript

My only goal. For an IT project. The exe would run 'in production' on a server and its function library can be edited/updated without having to modify the main exe.

Can you develop about ' shellexecute au3 source files' ? Sounds interesting but when I google it it seems not to fit exactly to what I need.

Edited by pedrit0

Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
Subz

What are the type of functions in your .au3 file?

Share this post


Link to post
Share on other sites
pedrit0

To be more specific, this library strictly contains var statements and functions. No processing.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
pedrit0

External functions that do not stick to the script own structure. These functions can be altered/modified without threatening the main script process.

The vars are global vars that could be used by several scripts later.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
pedrit0

What I mean is that I cannot pass trough using ini or xml files as a workaround. The goal is really to store some functions in the library.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
Jfish

How would the main script know about the new functions so as to execute them ... ini files would work for the vars, but you are saying you can't use those.  Why?  What is the difference between that and using an au3 file that contains the same info?


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
pedrit0

Oh I get your misunderstanding... sorry. I have made up this system:

- I have an ini file listing some steps of processings. Step# = FunctionName()

- I have the main script parsing the ini file and executing the iniread as a function call in a loop, whatever the function is and whatever its name. So no need to know the function for the main script.

- the function to be executed is stored in the functionlibrary.au3

- several persons need to update / add functions in the library without recompiling anything.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
Jfish

sounds like executing raw au3 files against the au3 exe from your main script as fed by the ini would work ... 

I created a program called "scriptrunner" that did basically that.  You could record scripts, edit them, and sequence them to be run from the main application.  There may be other ways that are better but I will defer to others for those ... 


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
pedrit0

yep but my issue remains : how to keep the library out ???


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
pedrit0

:-) that would be heaven if I could. These functions are to be called from the main exe.


Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
pedrit0

I have just tried but the global vars declared in the library are not detected by the main script... but i think this a good clue and I try out all I can with that tomorrow. Tired. Going to bed. thx a lot for the time you have spent on the topic :-)

Edited by pedrit0

Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

Share this post


Link to post
Share on other sites
pedrit0

to be noted : when using that you must disable Au3Check before compilation... it won't like unexplicitely declared vars.

Edited by pedrit0

Pedrit0, calme et tranquille, la tete dans les nuages et la b*** dans le champagne.

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

  • Similar Content

    • Fr33b0w
      By Fr33b0w
      Func z009() If FileExists("search\009\009.au3") Then #include <search\009\009.au3> EndIf EndFunc This wont work...  Is there any workarround for this or I should do it in a different way?
       
    • TrashBoat
      By TrashBoat
      How do i add a path to a file in Include.
      I want my script to get the udf in the same folder as the script/exe:
      Include "@ScriptDir/udf.au3" can this be done?
    • ur
      By ur
      I have recorded a gui installation and modified the au3 file as per my requirement.
      But the problem is, whenever I try to compile the au3 file, I am getting a special character on top of the file.

      Can you suggest how to resolve this as it is appearing everytime during compilation.
      And also I am trying to include a au3 file which is separate folder so I am adding the <..\Library.au3> line.
      It is able to pick that but in that file "Library.au3" there is a file install line.
      FileInstall(".\SendMail.ps1", @ScriptDir & "\SendMail.ps1") Library.au3 is being used by many other codes in the previous folder..
      But the current file is looking for the ps1 file in current folder.
      So is there any option to tell the compiler to pick the dependent files relative to Library.au3 instead of the current code.
    • xiantez
      By xiantez
      Hey AutoIT Community,
      Just wanted to know if there is a way I can #include all *.au3 files in my script without having to #include each individual .au3 file. For instance, currently I have a laundry list of #includes like this:
      #include <IE.au3>
      #include <Inet.au3>
      #include <AutoItConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <GDIPlus.au3>
      #include <GuiMenu.au3> 
      [ECT...ECT...]
      Would there be a way I could include all of the files above or all  .au3 file in a one liner? That way I do not have to burn up a bunch of lines of code for just my includes.... Your help is greatly appreciated...
    • Miliardsto
      By Miliardsto
      Is there possibility to do it like this?
      Cause as I see compiler doesn't see If statement in case of #include functions.
      It includes these two files all time.
      If $var == True Then #include 'func/funcsByTabs/main_Moda.au3' Else #include 'func/funcsByTabs/main_Others.au3' EndIf  
×