JohnBailey Posted March 16, 2007 Share Posted March 16, 2007 (edited) Why won't this work? It won't run the file - giving me "Unable to execute the external program." If I specify in the file what the location and name is in Run(here), then it works. However, it gives that error when I do it using the below method.$nextItemProgram = _GUICtrlListViewGetItemText($ListView1, $nextItem, 5) GUICtrlSetData($Status, "Program " & $nextItemName & " Ran "& $nextItemProgram) Dim $szDrive, $szDir, $szFName, $szExt ;<--- straight from the help file $TestPath = _PathSplit($nextItemProgram, $szDrive, $szDir, $szFName, $szExt) ;<--- straight from the help file Run($nextItemProgram,$szDrive&$TestPath[2])Edit: corrected syntax Edited March 16, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
therks Posted March 16, 2007 Share Posted March 16, 2007 (edited) Try this: $nextItemProgram = _GUICtrlListViewGetItemText($ListView1, $nextItem, 5) GUICtrlSetData($Status, "Program " & $nextItemName & " Ran "& $nextItemProgram) Dim $szDrive, $szDir, $szFName, $szExt ;<--- straight from the help file $TestPath = _PathSplit($nextItemProgram, $szDrive, $szDir, $szFName, $szExt) ;<--- straight from the help file MsgBox(0,'', $nextItemProgram & @LF & $szDrive & @LF & $TestPath[2]) Maybe what's being passed to Run() is not what you're expecting. *Edit: Also uh, you know that the 3rd parameter for run (where you're passing $szDrive&$TestPath[2]) is the window flag. It takes a value like @SW_HIDE, @SW_MAXIMIZE, or @SW_MINIMIZE. *Edit of edit: You edited your post and corrected the very thing I pointed out in this edit. So ignore this. Edited March 16, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 Saunders, yeah I thought that too. However, the msgbox reveals the correct information. A decision is a powerful thing Link to comment Share on other sites More sharing options...
martin Posted March 16, 2007 Share Posted March 16, 2007 (edited) By th ecorrect information do you mean correct to use in your script as you have shown? I would expect that you would need to add ':\' to the drive, '\', to the path and '.' before the extension. (But I haven't looked to see what Drive Split returns.) Edited March 16, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
therks Posted March 16, 2007 Share Posted March 16, 2007 Just so you know, since I can't see what's in the $nextItemProgram variable, it has to be a full path. For example, this will fail: Run('Program.exe', '"C:\Program Files\Folder"') Even if Program.exe is in that folder. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 The name file I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exethis worksRun('"I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exe"','I:\SAI\Auto-It files\')oÝ÷ ÚØb±Ú²z-jëh×6Run($nextItemProgram,'I:\SAI\Auto-It files\') A decision is a powerful thing Link to comment Share on other sites More sharing options...
therks Posted March 16, 2007 Share Posted March 16, 2007 Are there quotation marks around the filename in the variable? If you're pulling from a ListView, chances are there aren't. That seems to be a common pitfall. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 This is the problem - $nextItemProgram = '"I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exe"'It is a valid file name and pathThis works - $nextItemProgram = '"I:\SAI\Auto-It files\MA Run.exe"'Does it have something to do with the (M) A decision is a powerful thing Link to comment Share on other sites More sharing options...
therks Posted March 16, 2007 Share Posted March 16, 2007 I can't imagine... unless of course that file doesn't exist. But you've already checked that right? Please tell me you already checked that... My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 yes I've verified several times that it is a valid file name and location A decision is a powerful thing Link to comment Share on other sites More sharing options...
Valuater Posted March 16, 2007 Share Posted March 16, 2007 yes I've verified several times that it is a valid file name and location at times i have needed to do it this way If FileExists($program) Then RUNWAIT( FileGetShortName($program) ) 8) Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 Ok, I'm an idiot! I didn't think that there could be a problem with the exe haha. I thought I was just scripting wrong! :duh: thanks guys! I corrected the problem inside Internet Log Transfers - 10am - (M).exe and it works fine now. Miss one thing during diagnosis and you'll be scratching your head forever A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 Good call Valuater! I use that method a lot and it works wonders. I've never used the shortname part. Why that little added bit? Is that incase you're on an older OS or one that limits chars? A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 I guess I needed _DoesTheExeWorkYouDork() A decision is a powerful thing Link to comment Share on other sites More sharing options...
Valuater Posted March 16, 2007 Share Posted March 16, 2007 Good call Valuater! I use that method a lot and it works wonders. I've never used the shortname part. Why that little added bit? Is that incase you're on an older OS or one that limits chars?No sometimes it helps with spaces in the file name/location for me I guess I needed _DoesTheExeWorkYouDork() LOL... 8) Link to comment Share on other sites More sharing options...
JohnBailey Posted March 16, 2007 Author Share Posted March 16, 2007 No sometimes it helps with spaces in the file name/location for meOh, cool. I'll keep that in mind! I've had that problem before! A decision is a powerful thing 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