blessthefall Posted July 22, 2008 Share Posted July 22, 2008 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. Link to comment Share on other sites More sharing options...
rudi Posted July 22, 2008 Share Posted July 22, 2008 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! Link to comment Share on other sites More sharing options...
blessthefall Posted July 22, 2008 Author Share Posted July 22, 2008 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. Link to comment Share on other sites More sharing options...
Cha0sBG Posted July 22, 2008 Share Posted July 22, 2008 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. Link to comment Share on other sites More sharing options...
ResNullius Posted July 24, 2008 Share Posted July 24, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now