Jump to content



Photo

Run With Parameters?


  • Please log in to reply
9 replies to this topic

#1 Dev

Dev

    Wayfarer

  • Active Members
  • Pip
  • 53 posts

Posted 20 March 2004 - 02:49 PM

How do i run a program (like a game) using the Run() command?

This generates an error:
Run("myprg.exe -para1 -para2", "workingdir")

:iamstupid:

Thanks for your help :whistle:

And one thing: I AM NEW TO AUTOIT!...
hehe

Edited by Dev, 20 March 2004 - 02:50 PM.






#2 Jos

Jos

    oh joy ...

  • Developers
  • 21,047 posts

Posted 20 March 2004 - 03:24 PM

Try it this way:
run('"c:path\to\pgm\mypgm.exe" "param1" "param2"')

Notice the at the start and end of the whole string it has a single quote...

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 Dev

Dev

    Wayfarer

  • Active Members
  • Pip
  • 53 posts

Posted 20 March 2004 - 03:50 PM

Thanks man... Ill try later


:iamstupid:

#4 Dev

Dev

    Wayfarer

  • Active Members
  • Pip
  • 53 posts

Posted 21 March 2004 - 11:40 AM

Allright, another question, ive decieded to not make a new topic of it... You will notice why B)

$path = c:/program/MyApp/ $exe = MyApp.exe $params = -H - E -Y $fullpath = $path & $exe &  $params Run($fullpath, $path)


Ive seen this in other's codes, i dont really know how it works, and I would be very happy if someone could explain this :angry:


As allways ---> :iamstupid:

EDIT:
Maybe i should create a topic called "Dev's n00by Questions" :whistle:

Edited by Dev, 21 March 2004 - 11:43 AM.


#5 Jos

Jos

    oh joy ...

  • Developers
  • 21,047 posts

Posted 21 March 2004 - 02:58 PM

let see if i can explain:
Anything between " " is a string.
So you should put " " around the stuff you typed in the example.

$path = "c:/program/MyApp/"
$exe = "MyApp.exe"
$params = "-H - E -Y"

Then you concatenate these strings together with & ... but you need a space between the program and its parameters .. so:
$fullpath = $path & $exe & " " & $params

Now:
Run($fullpath, $path) is the same as:
Run("c:/program/MyApp/MyApp.exe -H - E -Y", c:/program/MyApp/)

ok ? :whistle:

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#6 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 21 March 2004 - 03:01 PM

Sort of off-topic-ish, but you're using Windows and you should probably use forward slashes "\" instead of backslashes "/". Although Windows itself (And the command line) will accept either forward or back, most applications and even a few command line related things won't work correctly when using backslashes.

For example, typing this into a console window on Windows XP doesn't change directories: cd C:/Windows

#7 Jos

Jos

    oh joy ...

  • Developers
  • 21,047 posts

Posted 21 March 2004 - 03:08 PM

forward slashes "\" instead of backslashes "/".

Yeap but now Backwards !!! :whistle:

You mean "\" backSlash and "/" Forward Slash ??

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#8 Dev

Dev

    Wayfarer

  • Active Members
  • Pip
  • 53 posts

Posted 21 March 2004 - 03:42 PM

Ok, thanks. Im sure this will help me :whistle:


Dont forget ---> :iamstupid:

#9 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 21 March 2004 - 04:11 PM

Yeap but now Backwards !!!    :whistle:

You mean "\" backSlash and "/" Forward Slash ??

Yeah, what he said.

#10 Dev

Dev

    Wayfarer

  • Active Members
  • Pip
  • 53 posts

Posted 21 March 2004 - 04:58 PM

Okay master, i will never write "/" in paths again :whistle:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users