Jump to content
Sign in to follow this  
blessthefall

New to AutoIt

Recommended Posts

blessthefall

Hey guys, i'm newer with autoit.

Just curious how to import variables from one script to another for the sake of being user friendly so that i can distribute it to friends who have no autoit experience.

For instance:

#####Script 1#####

$x = 1

$y = 2

$z = 3

###############

#####Script 2#####

$sum = $x + $y + $z

Send ($sum)

###############

I suspect that it has something to do with #Include, but i'm a nub. Any help is surely appreciated.

Share this post


Link to post
Share on other sites
rudi

Hey guys, i'm newer with autoit.

Just curious how to import variables from one script to another for the sake of being user friendly so that i can distribute it to friends who have no autoit experience.

For such purposes I'd use IniWrite() and IniRead(), and just *ONE* script.

Have a look at IniReadSection() and IniWriteSection() as well.

I suspect that it has something to do with #Include, but i'm a nub. Any help is surely appreciated.

That's also possible, but it makes no difference whether your friends have to recompile a 2nd prog or just an "all-in-one-Prog" muttley

This is a quick example for your thought:

; script1.au3
#include <script2.au3> ; save script2.au3 as %Programfiles%\Autoit3\include\script2.au3

$x = 1
$y = 2
$z = 3

MsgBox(64,"Result",MyCalc($x,$y,$z))oÝ÷ Ù©Ý~íí§vÇ+ZºÚ"µÍÈØÜ]LÂ[È^PØ[Ê   ÌÍÓØØ[ ÌÍÓØØ[K    ÌÍÓØØ[BT]  ÌÍÓØØ[
    ÌÍÓØØ[H
    ÌÍÓØØ[[[

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
blessthefall

For such purposes I'd use IniWrite() and IniRead(), and just *ONE* script.

Have a look at IniReadSection() and IniWriteSection() as well.

That's also possible, but it makes no difference whether your friends have to recompile a 2nd prog or just an "all-in-one-Prog" muttley

This is a quick example for your thought:

#include <script2.au3> ; save script2.au3 as %Programfiles%\Autoit3\include\script2.au3

$x = 1
$y = 2
$z = 3

MsgBox(64,"Result",MyCalc($x,$y,$z))oÝ÷ Ù©Ý~íí§vÇ+ZºÚ"µÍÈØÜ]LÂ[È^PØ[Ê   ÌÍÓØØ[ ÌÍÓØØ[K    ÌÍÓØØ[BT]  ÌÍÓØØ[
    ÌÍÓØØ[H
    ÌÍÓØØ[[[

regards, rudi.

I should have been a bit more clear... i would actually prefer to keep them separate for the sake of script integrity. I'd already have the script that's not intended for editing compiled.

Share this post


Link to post
Share on other sites
Cha0sBG

the way rudi showed is the only way i think


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites
ResNullius

I should have been a bit more clear... i would actually prefer to keep them separate for the sake of script integrity. I'd already have the script that's not intended for editing compiled.

Then rudi's first suggestion of using IniWrite() & IniRead() is the simplest.

Have your first script IniWrite() the values (I'm guessing based on some sort of user inpuut, or settings unique to the computer it's running on?).

Then have your 2nd, non-editable script IniRead() those values into the required variables.

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  

×