CFLam Posted February 2, 2007 Posted February 2, 2007 Hello all, I am using AutoIt 3.2.2.0 and I use it to automate one of my DOS application. It work like magic and now I would like to automate the application in 'background' mode. So I change my script from send to controlsend. But I find that ControlSend seems not work with console: ControlSend("cmd.exe","","","d:{Enter}") the d: display on the SciTE instead of the console window, seems that ControlSend can't detect it, I try the following as well: AutoItSetOption("WinTitleMatchMode",-4) ControlSend("classname=ConsoleWindowClass","","","d:{Enter}") also not work. anyone has a clue on it ? Also, how can I detect output from DOS application ? my app will display "Finished" in the console after finish the task, currently I am using: send ("!{space}es{enter}") and check with clipget() to see if the word "finished" appear, is there any other method to deal with it ? ControlSend support window context menu ? Thanks. Regds LAM Chi-fung
Moderators SmOke_N Posted February 2, 2007 Moderators Posted February 2, 2007 ControlSendPlus() <<--- Do a search for it. 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.
CFLam Posted February 2, 2007 Author Posted February 2, 2007 I try controlsendplus but still not work... #include "ControlSendPlus.au3" AutoItSetOption("WinTitleMatchMode",-2) AutoItSetOption("SendKeyDelay", 40) Run("cmd", "d:") sleep(3000) ControlSendPlus("cmd.exe","","","dir{enter}", 0) if the console is active, this work fine, but if it was minimize, the console cannot receive the "dir". Regds LAM Chi-fung
BrettF Posted February 2, 2007 Posted February 2, 2007 Try: AutoItSetOption("WinTitleMatchMode",-2) AutoItSetOption("SendKeyDelay", 40) Run("cmd", "d:") WinWaitActive ("cmd.exe") ControlSendPlus("cmd.exe","","","dir{enter}", 0) It should work Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
CFLam Posted February 2, 2007 Author Posted February 2, 2007 It works, but the purpose of ControlSend/ControlSendPlus is send to non-active windows... I try this also not work: #include "ControlSendPlus.au3" AutoItSetOption("WinTitleMatchMode",-2) AutoItSetOption("SendKeyDelay", 40) Run("cmd", "d:") WinWaitActive ("cmd.exe") WinSetState("cmd.exe","",@SW_MINIMIZE ) ControlSendPlus("cmd.exe","","","dir{enter}", 0)
BrettF Posted February 2, 2007 Posted February 2, 2007 (edited) Try changing it to AutoItSetOption("WinTitleMatchMode",-2) AutoItSetOption("SendKeyDelay", 40) Run("cmd", "d:", @SW_MINIMIZE) WinWaitActive ("cmd.exe") ControlSendPlus("cmd.exe","","","dir{enter}", 0) That worked for me... EDIT: Error in my code... Edited February 2, 2007 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
CFLam Posted February 5, 2007 Author Posted February 5, 2007 Hello, I try 3.2.0.1 and the ControlSend work, however, even with ControlSendPlus, I still not able to access the context menu of command prompt (console)... any hint ? Thanks. Regds LAM Chi-fung
CFLam Posted February 6, 2007 Author Posted February 6, 2007 Hello, I try this $mypid=run("C:\WINDOWS\System32\cmd.exe","d:\myapp",@SW_MAXIMIZE ,$STDOUT_CHILD) controlsend("cmd.exe","","","myapp{enter}") $line = StdoutRead($mypid) and the console become blank (black)...... my script right ? Regds LAM Chi-fung
/dev/null Posted February 6, 2007 Posted February 6, 2007 Hello,I try 3.2.0.1 and the ControlSend work, however, even with ControlSendPlus, I still not able to access the context menu of command prompt (console)... any hint ? Thanks.RegdsLAM Chi-fungcontext menu of the command prompt... How did you try to activate that with ControlSend(). Please post code. __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
CFLam Posted February 7, 2007 Author Posted February 7, 2007 oh... sorry for mis-leading, ControlSend can access ontext menu... only when Window (console) is in active mode ~_~ I am still looking for methods to work around this. Regds LAM Chi-fung
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