440LVB Posted May 12, 2005 Share Posted May 12, 2005 Hello I'm looking for a way to tell the script "Wait until this DOS command ends", maybe waiting for the prompt. Can I do that (the problem is that I use Sleep() function to wait the end of a copy, but the delay can be higher with many files or big files to copy, and I want it to be the smaller possible). Thx for suggestions Link to comment Share on other sites More sharing options...
Helge Posted May 12, 2005 Share Posted May 12, 2005 Use RunWait() instead of Run()... Link to comment Share on other sites More sharing options...
buzz44 Posted May 12, 2005 Share Posted May 12, 2005 (edited) RunWait(@ComSpec & " /c " & "commandName")Edit: Beat me Helge Edited May 12, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
440LVB Posted May 12, 2005 Author Share Posted May 12, 2005 RunWait(@ComSpec & " /c " & "commandName")Edit: Beat me Helge <{POST_SNAPBACK}>Are you sure of the way you wrote the command? Because I used RunWait(@ComSpec & " /c copy d:\folder\* n:\folder\") (saw that in the help file) and it didn't work... Link to comment Share on other sites More sharing options...
buzz44 Posted May 12, 2005 Share Posted May 12, 2005 (edited) What I wrote is from the help file... Try this...#Include <process.au3> _RunDOS("copy d:\folder\* n:\folder\")OrRun(@ComSpec & ' /c copy d:\folder\* n:\folder\', "", @SW_HIDE)Edit: Just testedRunWait(@ComSpec & " /c copy d:\folder\* n:\folder\")Does work, you probably have the parametres set not to create the folder if it doesn't exist. Type "help copy" in CMD and look at them, or you can simple create the folder "N:\Folder" prior to copying. Edited May 12, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
440LVB Posted May 12, 2005 Author Share Posted May 12, 2005 What I wrote is from the help file... Try this...#Include <process.au3> _RunDOS("copy d:\folder\* n:\folder\")OrRun(@ComSpec & ' /c copy d:\folder\* n:\folder\', "", @SW_HIDE)Edit: Just testedRunWait(@ComSpec & " /c copy d:\folder\* n:\folder\")Does work, you probably have the parametres set not to create the folder if it doesn't exist. Type "help copy" in CMD and look at them, or you can simple create the folder "N:\Folder" prior to copying.<{POST_SNAPBACK}>The folders do exist. Thank you for the code, I m going to test. Link to comment Share on other sites More sharing options...
440LVB Posted May 12, 2005 Author Share Posted May 12, 2005 (edited) OK it works. But with this syntax, how do i do to add a second command in the same cmd.exe windows? Is there better than RunWait(@ComSpec & " /c " & "copy n:\soft\matlab\* d:\thore\matlab {ENTER} t {ENTER}") (if this code is possible) EDIT : Probleme fixed (no need to add 't' to overwrite old files), but I'm still interested in the answer to the question how to execute successively 2 dos command, when the second depends on the result of the first (without closing the cmd.exe window) Edited May 12, 2005 by 440LVB Link to comment Share on other sites More sharing options...
CyberSlug Posted May 12, 2005 Share Posted May 12, 2005 I'm still interested in the answer to the question how to execute successively 2 dos command, when the second depends on the result of the first (without closing the cmd.exe window)Create a batch file. Or the StdIO features in the latest AutoIt beta version might work.... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
440LVB Posted May 12, 2005 Author Share Posted May 12, 2005 Create a batch file. Or the StdIO features in the latest AutoIt beta version might work....<{POST_SNAPBACK}>Yep batch, thx. Not used to using DOS.... Link to comment Share on other sites More sharing options...
440LVB Posted May 13, 2005 Author Share Posted May 13, 2005 UP Batch works but is there a simpler way? This kind of command doesn't work : RunWait(@ComSpec & " /c " & "copy n:\soft\matlab\* d:\thore\matlab {ENTER} t {ENTER}") How can I do when I need to answer (yes/no) a question, without using send() function, in order to avoid mix between the send() message and user typing something on the keyboard. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 13, 2005 Share Posted May 13, 2005 Have you looked at the AutoIt FileCopy function? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
440LVB Posted May 13, 2005 Author Share Posted May 13, 2005 Have you looked at the AutoIt FileCopy function?<{POST_SNAPBACK}>The problem is no more on the copy (overwrite automatically), but with the cacls function (to change rights) which needs a confirmation (y or n) Link to comment Share on other sites More sharing options...
GaryFrost Posted May 13, 2005 Share Posted May 13, 2005 In that case you'll probably have to pipe the answer in within a batch file, don't have an example or remember the exact sytax of what we used at work but seems like was something like @echo y|command SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
440LVB Posted May 13, 2005 Author Share Posted May 13, 2005 (edited) In that case you'll probably have to pipe the answer in within a batch file, don't have an example or remember the exact sytax of what we used at workbut seems like was something like@echo y|command<{POST_SNAPBACK}>Hm OK but this solution requires a batch file. No autoIT command to say "execute this command in the open cmd.exe window", without using Send() ? Edited May 13, 2005 by 440LVB 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