I am running an AutoIt script and that script calls another AutoIt file. How do I pass a variable value from my first script to the next?
How to pass a variable value from one AutoIt script script to the next
5.4k Views Asked by Tony Davis At
2
There are 2 best solutions below
0

Use command line interface in order to communicate between two files. File 2 must be compiled.
File1.exe:
$ThisIsVariableFromFIle1 = "This is some text."
Run("File2.exe " & $ThisIsVariableFromFIle1)
File2.exe:
MsgBox(0,"This is the whole commandline I got", $CmdLineRaw)
MsgBox(0,"This is part one", $CmdLine[1]); This
MsgBox(0,"This is part two", $CmdLine[2]); is
MsgBox(0,"This is part three", $CmdLine[3]); some
You need to learn the scope concept of a variable (Dim, Global & Local variables).
Examples with two files: main.au3 and constantes.au3.
Content of constants.au3
Content of main.au3
More information is here: http://www.autoitscript.fr/autoit3/docs/keywords/Dim.htm