Sign in to follow this  
Followers 0
aryx

Dynamic RUN() command

8 posts in this topic

#1 ·  Posted (edited)

Hi, I want to automate closing a window when I start a program, but I need have a dynamic command that has to change every time I start the application.

Here is an examples:

"C:\Program Files\myprogram\myprogram.exe" /directory "C:\temp" "t:\12112006.dat"

So what I want to do is to start the script with paramenters and put them in the Run() command. For example:

RUN("C:\Program Files\myprogram\myprogram.exe /directory C:\temp" "T:\" & %params% & ".dat")

Is it possible to do something like that?

Best Regards

Edited by aryx

Share this post


Link to post
Share on other sites



Hi, I want to automate closing a window when I start a program, but I need have a dynamic command that has to change every time I start the application.

Here is an examples:

So what I want to do is to start the script with paramenters and put them in the Run() command. For example:

RUN("C:\Program Files\myprogram\myprogram.exe /directory C:\temp" "T:\" & %params% & ".dat")

Is it possible to do something like that?

Best Regards

Yes

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$parameters = 12112006

RUN("C:\Program Files\myprogram\myprogram.exe /directory C:\temp" "T:\" & $parameters & ".dat")

this will not work as wriiten... just the concept is correct

see help for directory and quotes use

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

$parameters = 12112006

RUN("C:\Program Files\myprogram\myprogram.exe /directory C:\temp" "T:\" & $parameters & ".dat")

this will not work as wriiten... just the concept is correct

see help for directory and quotes use

8)

Ok, thanks, but the values can't come from the script, it has to come from the initial command to run the script...

So if I compile a script as myscript.exe

I want to run it by entering myscript.exe 12112006 or myscript.exe /mystring:12112006

and then the script will add this in the parameters variable.

Is it possible? I've tried to look at the Function Run under Help, but I can't find any information on this situation.

Share this post


Link to post
Share on other sites

You need spaces between each of your parameters. Something like this maybe:

Run('"C:\Program Files\myprogram\myprogram.exe"' & " /directory C:\temp" & ' "T:\' & $parameters & '.dat"')


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I think I found the answer when I searched for param*

$CmdLine[1] should equal the data that is passed at the command line.

Share this post


Link to post
Share on other sites

I think I found the answer when I searched for param*

$CmdLine[1] should equal the data that is passed at the command line.

I was under the impression you wanted to send the params not retrieve them, but yes, we use $cmdline[n] to retrieve the parameters sent to our apps.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry if I didn't write it clearly enough :whistle: But it looks like I got what I need, will test it out now :-)

Thanks for your quick and helpful response!

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  
Followers 0