Guest p.boutonnet Posted August 29, 2005 Share Posted August 29, 2005 Hi, With Notepad, it works: ControlSend("Untitled", "", "Edit1", "This is a line of text in the Notepad window") My purpose is to use the same script for CMD.exe instead of Notepad. I try: ControlSend ( "Command Prompt", "","????", "This is a command line in the CMD.exe window") I don't find a "ClassName" to substitute to the "????". Is it possible? If not, an another function to use? I can not use the Send function because my CMD.exe window is not always the active window during the process. Thank you very much, PB Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 29, 2005 Moderators Share Posted August 29, 2005 Have you tried Run(@ComSpec, etc..., etc...)? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted August 29, 2005 Share Posted August 29, 2005 process? A solution maybe given if the task was known. The command console is not a standard win32 application like notepad, so you would expect different results to happen. It also has not controls, so ControlSend, if works ok, is a blind attempt. If you want to pursue with a send function, then ControlSendPlus may help. It is in the scripts n scraps forum if searched. Other alternatives could be a dos batch file or to use direct Runwait commands to @ComSpec. Link to comment Share on other sites More sharing options...
Guest p.boutonnet Posted August 29, 2005 Share Posted August 29, 2005 I try precisely this: (Notice I am beginner .. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Run(@COMSPEC) WinWaitActive (@COMSPEC) Send("title MyCMDWindow{ENTER}") send ("cd C:\MyFolder{ENTER}") send ("ftp 127.0.0.1{ENTER}") sleep(500) Send("ntuser{ENTER}") sleep(500) send("ntuser{ENTER}") sleep(500) Send ("bin{ENTER}") Send ("prompt{ENTER}") Send ("mget *.mat{ENTER}") Send ("y{ENTER}") Send ("quit{ENTER}") send("FOR %f IN (""*.mat"") DO ( MyEXE.exe -c %f ){ENTER}") WinWaitClose ("MyEXE.exe") Send ("exit{ENTER}") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While the execution of the script above, the PC user can work on other things and "MyCMDWindow" is not the currently active windows. So the Send("") command does not achieve the work. I think about ControlSend, but you confirm it is not possible. Runwait is not adapted too. I looking for the ControlSendPlus function... Perhaps a completely different way to program my script above? Thank you very much Link to comment Share on other sites More sharing options...
AutoChris Posted August 29, 2005 Share Posted August 29, 2005 Since your script runs pretty quickly before you get to...send("FOR %f IN (""*.mat"") DO ( MyEXE.exe -c %f ){ENTER}")...why not minimize the window(s) when you get to this point, and your WinWaitClose() function will still work to close the "MyEXE" program and then exit. 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