Gene Posted February 3, 2005 Share Posted February 3, 2005 (edited) The following code... $sBasePath = FileSelectFolder ( "Select folder to process", "My Computer" , 2 ) MsgBox(0, "Command line", @ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process) RunWait(@ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process, 5 ) produces the following result...The MsgBox gives: C:\WINNT\system32\cmd.exe /c dir K:\_JPG\050202\*.jpg /o:d /b > K:\_JPG\050202\DirList.TXT the RunWait command gives this error message: Line 9 (File "C:\RenameAsNeeded.Au3"):RunWait(@ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process, 5 )Error: Unable to execute the external program.The directory name is invalid.When I run the command shown by the MsgBox at a command prompt it produces a date ordered list of files in the specified text file. Can anyone say why the RunWait command doesn't get the same result? Edited February 3, 2005 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
blakel Posted February 3, 2005 Share Posted February 3, 2005 change @comspec /c to @comspec /k for debugging Link to comment Share on other sites More sharing options...
Gene Posted February 3, 2005 Author Share Posted February 3, 2005 change @comspec /c to@comspec /kfor debugging<{POST_SNAPBACK}>OK, I did that. No change from before except the MsgBox and error dialog displayed the "k" instead of the "c". The command prompt window remained open with the command shown by the MsgBox displayed, when executed it produced the expected file. The script still failed at the RunWait command. I do appreciate the response. [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
blakel Posted February 3, 2005 Share Posted February 3, 2005 OK, I did that. No change from before except the MsgBox and error dialog displayed the "k" instead of the "c". The command prompt window remained open with the command shown by the MsgBox displayed, when executed it produced the expected file. The script still failed at the RunWait command. I do appreciate the response.<{POST_SNAPBACK}>are you testing @errorwith opt(r"runerrorsfatal",0) ;that is not exact Link to comment Share on other sites More sharing options...
buzz44 Posted February 3, 2005 Share Posted February 3, 2005 (edited) i think the problem is ur use of qoutation marks because u r using a variable ...try going off this ... Run(@ComSpec & ' /c xcopy /e /h /y "' & $Folder1 & '" "' & $Folder2 & '"', "", @SW_HIDE) that is a snippet from a script that i made .. it works Edited February 3, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Gene Posted February 3, 2005 Author Share Posted February 3, 2005 are you testing @errorwith opt(r"runerrorsfatal",0) ;that is not exact<{POST_SNAPBACK}>No, but if the RunWait command fails there is no reason to the script to continue. [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
Gene Posted February 3, 2005 Author Share Posted February 3, 2005 i think the problem is ur use of qoutation marks because u r using a variable ...try going off this ...Run(@ComSpec & ' /c xcopy /e /h /y "' & $Folder1 & '" "' & $Folder2 & '"', "", @SW_HIDE)that is a snippet from a script that i made .. it works<{POST_SNAPBACK}>If my dbl quotes were unbalanced or needed to be shown on the command line I would probably agree with you. In my initial post I mentioned that the MsgBox showed the command line before it was handed to the RunWait command. What it shows is perfect, and when pasted in at a DOS prompt it runs and produces as expected. [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
MHz Posted February 3, 2005 Share Posted February 3, 2005 Line 9 (File "C:\RenameAsNeeded.Au3"):RunWait(@ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process, 5 )Error: Unable to execute the external program.The directory name is invalid.A simple view of your runwait command.RunWait( "Your Commands", 5)What is the ,5 for ? Link to comment Share on other sites More sharing options...
Gene Posted February 3, 2005 Author Share Posted February 3, 2005 A simple view of your runwait command.RunWait( "Your Commands", 5)What is the ,5 for ?<{POST_SNAPBACK}>Good question, I don't have a clue, I removed it and here are the results...$sBasePath = FileSelectFolder ( "Select folder to process", "My Computer" , 2 ) ;Run(@ComSpec & " /c " & "cd /d " & $sBasePath, @SW_MINIMIZE ) MsgBox(0, "Command line", @ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process) RunWait(@ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process, @SW_MINIMIZE ) MsgBox output below:C:\WINNT\system32\cmd.exe /c dir K:\_JPG\050202\*.jpg /o:d /b > K:\_JPG\050202\DirList.TXTError message below:Line 10 (File "C:\RenameAsNeeded.Au3"):RunWait(@ComSpec & " /c " & "dir " & $sBasePath & "\*.jpg /o:d /b " & " > " & $sBasePath & "\" & $sFile2Process, @SW_MINIMIZE )Error: Unable to execute the external program.The directory name is invalid.Thank you for pointing that out. Unfortunately, the result didn't change. [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
MHz Posted February 3, 2005 Share Posted February 3, 2005 RunWait ( "filename" [, "workingdir" [, flag]] )I still think you missed something. The working directory parameter.E.g.RunWait( "Your Commands", "", @SW_MINIMIZE)instead ofRunWait( "Your Commands", @SW_MINIMIZE) Link to comment Share on other sites More sharing options...
Gene Posted February 3, 2005 Author Share Posted February 3, 2005 RunWait ( "filename" [, "workingdir" [, flag]] )I still think you missed something. The working directory parameter.E.g.RunWait( "Your Commands", "", @SW_MINIMIZE)instead ofRunWait( "Your Commands", @SW_MINIMIZE)<{POST_SNAPBACK}>Yup, that would be correct. I got so focused on the command line and the flag that I forgot about that little piece in between.Thanks to all for your help! [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... 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