|
|
|||||||
Hello everyone!! Thanks for your help and for this fantastic forum, i have learned a lot!! And now, my question... Is possible to pass a variable from bat to kix?? thanks for all!! |
||||||||
|
|
|||||||
You can set is as an environment variable for example. Kix can access environment variables and use them further on in the script. Example BAT command: Code: Set Test=123abc Example kix code: Code: Break on $test = ExpandEnvironmentVars(%test%) If $test = "123abc" ;do something Else ;do something else EndIf |
||||||||
|
|
|||||||
Thanks Mart!! Itīs OK!! Another thing that iīve learned!!!! |
||||||||
|
|
|||||||
Consider the following: With SET VAR=Value in a bat file that later calls Kix, that value will be available to the Kix script and any programs (including bat files) that are invoked by Kix RUN or SHELL commands, as well as commands in the original batch file that first invoked Kix32 but come after the Kix command. This is what Mart demonstrated above. You can also pass values directly to variables in the Kix script: Code: Set Var=123 Kix32.exe myscript.kix $KixVar1=%VAR% KixVar2="some text" Code: Kix32 myscript.kix %VAR% "some text" Finally, be aware that if you set an environment variable in a batch file that was invoked from a Kix RUN or SHELL command, that the value will NOT be returned to Kix. When you define an environment variable, any program called from that point forward will have a COPY of that value placed in its environment. This is a Parent/Child concept - the child program inherits a copy of its parent's environment. It can do anything to the variables without impacting the parent's values. If you need to run a command (batch file, exe, etc) and want to return a value to the (parent) Kix script, you should use something like the WSHPipe() UDF. This returns all of the output from the command directly to a Kixtart variable. Glenn |
||||||||
|
|
|||||||
Thanks Glenn!! All this, is clear now!! |