Dumpy Dooby Posted May 20, 2005 Share Posted May 20, 2005 Why doesn't this work? Run ( "%programfiles%\FlashFXP\Flashfxp.exe", "%programfiles\Flashfxp\", "" ) When I try that, it says "Unable to execute the external program. The system cannot find the file specified." Yes, my program files directory is on drive d: and yes, if I click start->run and type "%programfiles%\FlashFXP\Flashfxp.exe," it works just fine. It also works just fine if I click start->run and type "d:\program files\flashfxp\flashfxp.exe." What gives? Any way that I could do this using @ComSpec? I'm using AutoIt v3, btw. PS- I'm currently using the following Send ("#r") ControlClick ( "Run","","edit1","","2" ) Send ("%programfiles%\FlashFXP\flashfxp.exe{Enter}") But I've had some problems with that one if my computer is running slow. Besides, that won't exactly work on my unattended xp disc as there is no start button during the XP install. Link to comment Share on other sites More sharing options...
Dumpy Dooby Posted May 20, 2005 Author Share Posted May 20, 2005 Ah-ha! I just discovered "@programfilesdir" So ... now how do I implement @programfilesdir into my script? Link to comment Share on other sites More sharing options...
JerryD Posted May 20, 2005 Share Posted May 20, 2005 Ah-ha! I just discovered "@programfilesdir"So ... now how do I implement @programfilesdir into my script?<{POST_SNAPBACK}>Your original line of code:Run ( "%programfiles%\FlashFXP\Flashfxp.exe", "%programfiles\Flashfxp\", "" )would now be:Run ( @ProgramFilesDir & "\FlashFXP\Flashfxp.exe", @ProgramFilesDir & "\Flashfxp" )You don't need the third paramater of empty quotes - it's an optional paramater.Note that if you wanted to pass Flashfxp a paramater, you'd need to put double quotes around the program's path (as well as the paramater if it's path contained any spaces) such as:Run ( '"' & @ProgramFilesDir & '\FlashFXP\Flashfxp.exe" "' & $Parm & '"', @ProgramFilesDir & '\Flashfxp' )Although I use double quotes to define strings out of habit all the time, it's probably better to use the single quote to define strings so that you can use double quotes freely when needed. There are no double quotes around the second paramater (@ProgramFilesDir & '\Flashfxp') because it's the only string being passed.Finally, you can always circumvent the space character problem by creating a variable to hold the short file name of the item (full path of program or paramater) like this:$MyProg = FileGetShortName ( @ProgramFilesDir & "\FlashFXP\Flashfxp.exe" )$MyProgDir = FileGetShortName ( @ProgramFilesDir & "\FlashFXP" )$MyParm = FileGetShortName ( "C:\Documents and Settings\parm.dat" )Run ( $MyProg & " " & $MyParm, $MyProgDir )J Link to comment Share on other sites More sharing options...
Dumpy Dooby Posted May 20, 2005 Author Share Posted May 20, 2005 Hey, thanks a bunch man. I had tried converting it to short file names, but I must've done it differently. I also had a slash at the end of the working directory ... not sure if that would have made a difference. Anyway, I copy/pasted what you had there and it worked just fine. Thanks 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