Jump to content

Wait to complete the process before sending a command (to cmd window)


weszzer
 Share

Recommended Posts

My Autoit script is sending a command to extract a data as excel/csv file , the extracted file size is not less than 10mb it can be more than 300mb. After the file extracted there is no message or anything, is automatically goes to “ C: “ .

But since the time to extract the date is not the same at all times, so the sleep command before I send (“exit”) then send ("[enter]") to exit from cmd window is not possible.

 Is there any command to detect if the cmd prompt is return to c: so I can send a exit command.

Thank you.

Send ("c:\extract_data.exe " & @YEAR &"/" & @MON & "/" & @MDAY)
Sleep("2000")
Send ("{Enter}")
;(wait until the file extracted then send and EXIT command to exit)
send ("Exit") ; from c:\  - but extracting is completed?
Send ("{Enter}")

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

  • Moderators

Or simply use RunWait, instead of the command line:

RunWait("c:\extract_data.exe " & @YEAR &"/" & @MON & "/" & @MDAY)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

How are you opening command prompt?

 

Yes JohnOne, I'm using a command prompt to execute the command, then after the command completed it goes directly to c: _ or it prompt to c; without any message.

Problem is before my sleep time/delay elapsed the process is not completed.

Thank you for the response.

Link to comment
Share on other sites

I still can't figure out on how to exit to cmd-console after my file extracted. then adding a pop-up message saying "Data Extracted"

#include <date.au3>
Run("cmd.exe")
Sleep(2000)
Send ("C:\Extract.exe DATE= 20/08/2011")
;wait to complete the extraction then exit the command/dos console then a pop-up message saying "file extracted"

After the file created the command automatically goes to "C:" it mean the process is completed, then I would like to exit the console then a pop-up message

saying "Data Extracted" with the date from the last day or previous day.

Need your help guys.. Thank you very much.

Edited by weszzer
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...