redndahead Posted January 8, 2004 Posted January 8, 2004 I am trying to run a program. When you go to the shortcut and look at it's path it looks like this. Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student What I want to do is run my script with the command line option so it would look like this. C:\myscript.au3 "Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student" If my script is like this it doesn't run right: run($CmdLine[1]) exit But clicking on the shortcut is ok Any ideas.... red
scriptkitty Posted January 8, 2004 Posted January 8, 2004 if you run it like this: C:\myscript.au3 "Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student" $CmdLine[0]=2 $CmdLine[1]=Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE $CmdLine[2]=Management;Login;Student so try if $CmdLine[0]=2 then run($CmdLine[1]& " "&$CmdLine[2]) if $CmdLine[0]=1 then run($CmdLine[1]) AutoIt3, the MACGYVER Pocket Knife for computers.
redndahead Posted January 8, 2004 Author Posted January 8, 2004 well that doesn't work.... it looks like if i use any other switch it is ok as is. So is there a problem with having semicolons ";" ? red
redndahead Posted January 8, 2004 Author Posted January 8, 2004 Sorry guys...I found out what it was. The program used a completely different working directory than where the executable was in... Just a big pain in the butt. red
Developers Jos Posted January 8, 2004 Developers Posted January 8, 2004 could you try it this way? $tc = '' for $x = 1 to $CmdLine[0]$tc = $tc & ' ' & $CmdLine[$x] next $tc = $tc & '' run(@comspec & " /c " & $tc) exit 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.Â
scriptkitty Posted January 8, 2004 Posted January 8, 2004 I think your problem is the spaces. Command Lines are usually seperated with spaces, which is why they need to be in Quotes. run your link C:\myscript.au3 "Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student" code to test ;C:\myscript.au3 $x="Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student" if $CmdLine[0]=2 then $y=$CmdLine[1]&" "&$CmdLine[2] if $CmdLine[0]=1 then $y=$CmdLine[1] msgbox(1,"Do these match?,$x & @crlf & $y) ;run("Z:\TLCS\PROGRAMS\LOGIN\SB4S.EXE Management;Login;Student") ;run($y) AutoIt3, the MACGYVER Pocket Knife for computers.
redndahead Posted January 8, 2004 Author Posted January 8, 2004 Errr uh thanks guys for the reply but I posted before.... Well maybe you haven't seen it yet. That it was only that that certain program used a completely different working dir. But thanks for all the suggestions. red
scriptkitty Posted January 8, 2004 Posted January 8, 2004 Yea, we all type slow I guess, nice to see three responces in one minute though AutoIt3, the MACGYVER Pocket Knife for computers.
redndahead Posted January 8, 2004 Author Posted January 8, 2004 Dang I didn't recognize that it was all in one minute. Pretty nice
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