anyday Posted October 8, 2008 Share Posted October 8, 2008 i have a simple question, ive searched threw the forums a bit but have not seen what im looking for. i have a script that runs a dos command, using just Run("filename.exe"), it will run the program just fine, but i need to send a keystroke the the dos console window that opens. Ive tried send("{SPACE}") also tried ControlSend with no luck. Anyone have any advice on howto send a keystroke to a dos command prompt? Thanks Link to comment Share on other sites More sharing options...
Andreik Posted October 8, 2008 Share Posted October 8, 2008 (edited) i have a simple question, ive searched threw the forums a bit but have not seen what im looking for. i have a script that runs a dos command, using just Run("filename.exe"), it will run the program just fine, but i need to send a keystroke the the dos console window that opens. Ive tried send("{SPACE}") also tried ControlSend with no luck. Anyone have any advice on howto send a keystroke to a dos command prompt? ThanksControlSend() doesn't work for DOS, try Send(). Example: Run('cmd',@SystemDir,@SW_HIDE) WinWait(@SystemDir & "\cmd.exe") WinActivate(@SystemDir & "\cmd.exe") Send('ver' & @CRLF) WinSetState(@SystemDir & "\cmd.exe","",@SW_SHOW) Edited October 8, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
anyday Posted October 8, 2008 Author Share Posted October 8, 2008 Ive been trying send() it has no effect Link to comment Share on other sites More sharing options...
Andreik Posted October 8, 2008 Share Posted October 8, 2008 Ive been trying send() it has no effectJust look my edit in preview post (an example). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Marlo Posted October 8, 2008 Share Posted October 8, 2008 (edited) This should work OK Opt("WinTitleMatchMode", 2) WinActivate("cmd.exe") Send("{ENTER}") Dam, Beat me to it Andreik =( Edited October 8, 2008 by Marlo Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
anyday Posted October 8, 2008 Author Share Posted October 8, 2008 thanks for the help guys, i tried your example Andreik with no success, but everything working good now with the Opt("WinTitleMatchMode", 2) Link to comment Share on other sites More sharing options...
Andreik Posted October 8, 2008 Share Posted October 8, 2008 thanks for the help guys, i tried your example Andreik with no success, but everything working good now with the Opt("WinTitleMatchMode", 2) With WinTitleMatchMode is more delicate problem. If you have a window that contains the word 'cmd' is not too good. To avoid this problem, use only started WinTitleMatchMode, then you can give DOS window a unique name. AutoItSetOption("WinTitleMatchMode",2) Run('cmd.exe',@SystemDir,@SW_HIDE) WinWait("cmd.exe") WinActivate("cmd.exe") Send('TITLE MyCMD' & @CRLF) WinSetState('MyCMD','',@SW_SHOW) When the words fail... music speaks. 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