Dev Posted March 20, 2004 Share Posted March 20, 2004 (edited) 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 And one thing: I AM NEW TO AUTOIT!... hehe Edited March 20, 2004 by Dev Link to comment Share on other sites More sharing options...
Developers Jos Posted March 20, 2004 Developers Share Posted March 20, 2004 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... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Dev Posted March 20, 2004 Author Share Posted March 20, 2004 Thanks man... Ill try later :iamstupid: Link to comment Share on other sites More sharing options...
Dev Posted March 21, 2004 Author Share Posted March 21, 2004 (edited) Allright, another question, ive decieded to not make a new topic of it... You will notice why $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 As allways ---> :iamstupid:EDIT:Maybe i should create a topic called "Dev's n00by Questions" Edited March 21, 2004 by Dev Link to comment Share on other sites More sharing options...
Developers Jos Posted March 21, 2004 Developers Share Posted March 21, 2004 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 ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted March 21, 2004 Share Posted March 21, 2004 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 21, 2004 Developers Share Posted March 21, 2004 forward slashes "\" instead of backslashes "/".Yeap but now Backwards !!! You mean "\" backSlash and "/" Forward Slash ?? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Dev Posted March 21, 2004 Author Share Posted March 21, 2004 Ok, thanks. Im sure this will help me Dont forget ---> :iamstupid: Link to comment Share on other sites More sharing options...
Valik Posted March 21, 2004 Share Posted March 21, 2004 Yeap but now Backwards !!! You mean "\" backSlash and "/" Forward Slash ??Yeah, what he said. Link to comment Share on other sites More sharing options...
Dev Posted March 21, 2004 Author Share Posted March 21, 2004 Okay master, i will never write "/" in paths again Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now