Jump to content
Sign in to follow this  
Xand3r

dynamic includes?

Recommended Posts

Xand3r

Is it possible to include files after compilation?

for example:

i have 2 scripts - main script and second script

is there a way to compile the main script and then change the second script and it still gets included ?(with the new content ofc)


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites
weaponx

To put it simply, no.

Think of the compilation process being similar to baking cookies. If one dough has chocolate chips and one has walnuts you can easily integrate them together prior to baking. Once they are baked you can no longer add ingredients.

Share this post


Link to post
Share on other sites
Xand3r

well let's use your example :

you bake a cake(it's bigger :)) and then...

lets say u want to add suggar on top

that's what i want :(

Edit:

i know how to... do it ... sort of but...

you have a blank exe that runs the main script wich includes the second script

but... that way the main script is not compiled :D it's just executed

Edited by TheMadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites
Richard Robertson

Sugar is defined as: write a script parser and parse your secondary script.

Share this post


Link to post
Share on other sites
Xand3r

ok .. bad example ...

anyway it would be great if we could do that :(

it would be so easy do add `plugins` to our scripts

btw: thanks for the replys :)

Edited by TheMadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites
AdmiralAlkex

There are many ways to fake "plugins", look at how my "Franks Gadget" work or search for others in the Example Scripts forum

Edit: PPlayer has plugins, maybe worth checking also

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites
Xand3r

tnx .. i'll check it out


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites
weaponx

ok .. bad example ...

anyway it would be great if we could do that :(

it would be so easy do add `plugins` to our scripts

btw: thanks for the replys :)

Well you can just keep your scripts uncompiled and distribute them with the autoit wrapper, or use one empty compiled script that just calls your main and secondary scripts using /Autoit3ExecuteScript

http://www.autoitscript.com/autoit3/docs/i...htm#CommandLine

Share this post


Link to post
Share on other sites
Xand3r

base.exe:

Run(@AutoItExe & ' /AutoIt3ExecuteScript "main.au3"')oÝ÷ Úf¢«·jëh×6$a=InputBox("" , "")
If $a="1" Then
    #include"1.au3"
ElseIf $a="2" Then
    #include"2.au3"
EndIfoÝ÷ ÛV®Ý«­¢+Ù5Í  ½à À°ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÅÕ½ÐíÔÝɽÑÄÅÕ½Ðì¤oÝ÷ Ûf®Ý«­¢+Ù5Í    ½à À°ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÅÕ½ÐíÔÝɽÑÈÅÕ½Ðì¤

this does exactly what i want :( but... as u can see the source of the main is not copiled..

well gues i have to ... live with it :)


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites
SkinnyWhiteGuy

Your example only works due to 1.au3 and 2.au3 being very simple, and won't work for larger things. #Include Statements are basically Code that the Interpreter sees, and where ever it sees these, it copies the entire file that you reference there in to where the #include line is. So, your example translates to:

$a=InputBox("" , "")
If $a="1" Then
    MsgBox(0 , "test" , "u wrote 1")
ElseIf $a="2" Then
    MsgBox(0 , "test" , "u wrote 2")
EndIf

That is done internally BEFORE your script is ran. Once your script is running, you can delete your files, or just move them onto a FlashDrive, and remove them from the computer, and the program will continue to run with your #include lines, because of this fact.

I looked into "plugins" or at least Dynamic Code execution, and after studying how it all works, I personally decided it wasn't worth it for just my play project (game server). Like Richard said, to truly do what you want, you'd have to write your own Script Parser, which is no trivial task.

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

maybe you can include all include files in main and then read your second script and execute the source with execute command.

Mega

P.S: Why updating compiled files?


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Xand3r

i'm not trying to update compiled files i'm trying to make it possible to add code to an already compiled script by the use of an external .au3..

and... oups i tried what u said about the includes and you were right :)


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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  

×