Jump to content

Recommended Posts

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
  • Moderators
Posted

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

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.

Posted

$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

Posted

$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.

  • Moderators
Posted

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"')

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.

Posted

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

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

  • Moderators
Posted

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.

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.

Posted

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!

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...