Jump to content

Recommended Posts

Posted

Hi all,

I'm calling my script from the DOS.

When I call the exe, I want to send also a value for a variable of my scrypt... which is the best pratice to follow?

Many thanks for all in advance.

Posted

Search the help file for "Command Line Parameters". When you pass a parameter into a script, it will be stored in an array variable $CmdLine. 

Example, make this .au3 script:

#include <Array.au3>

_ArrayDisplay($CmdLine)

Then run this command from a DOS prompt or create a .bat file:

test.au3 -this_is_the_parameter_sent /second_parameter

You will get an array that shows the two parameters. From there, you can write code to use $CmdLine[0] to check if any parameters have been sent, and if any have been sent, $CmdLine[1] will be the first. If any others were sent, they will be the same, but with a 2, 3, 4, etc. 

All clear?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...