TheBobynator Posted March 5, 2009 Share Posted March 5, 2009 (edited) hi, how can i get the text from a dos window. i mean the black window. is it possible? thx Edited March 5, 2009 by TheBobynator Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 Yes... #include <Constants.au3> ; Example Usage $result= _CMDreturn('net stop "Print Spooler"') msgbox(0,"Version",$result) ;Another Example Usage $result= _CMDreturn('net start "Print Spooler"') msgbox(0,"Version",$result) Func _CMDreturn($sCommand) ; This function returns the output of a DOS command as a string $cmdreturn = "" $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) While 1 ; loop through the return from the command until there is no more $line = StdoutRead($stream) If @error Then ExitLoop $cmdreturn &= $line WEnd Return $cmdreturn EndFunc ;==>_CMDreturn [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
TheBobynator Posted March 5, 2009 Author Share Posted March 5, 2009 this script is very complicated. i want to read a specific dos window. where must i put the name of the window which i want to read in? sry for my english Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 That script does not work that way. I do not think it is possible to read from a pre-existing DOS window.. unless you are looking at some kind of OCR method. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
TheBobynator Posted March 5, 2009 Author Share Posted March 5, 2009 whats ocr? Link to comment Share on other sites More sharing options...
James Posted March 5, 2009 Share Posted March 5, 2009 (edited) whats ocr? Optical Character Recognition.I think you should put the keyboard down and back away slowly before your hurt anyone but yourself. Edited March 5, 2009 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
dannyk Posted April 3, 2009 Share Posted April 3, 2009 That script does not work that way. I do not think it is possible to read from a pre-existing DOS window.. unless you are looking at some kind of OCR method.That's exactly what I'm trying to do -- read from a pre-existing DOS window that is spawned by a windows app. I can get its process id, and I can send text to the dos window via the send command once I activate the window. However, this dos popup window does some processing of its own before asking user to input data, and I need to somehow determine when it's ready for input. Any help would definitely be appreciated!Thanks,Danny Link to comment Share on other sites More sharing options...
Exit Posted April 3, 2009 Share Posted April 3, 2009 Perhaps this helps: MsgBox(0+262144, "", "click OK to start a sample CMD window") $cmd = "ipconfig" Run(@ComSpec & " /k " & $cmd, "", @SW_SHOW) MsgBox(0+262144, "", "click OK to read the window to clipbox and show result") WinWaitActive("[CLASS:ConsoleWindowClass]") Send("!{space}{down 6}{right}{down 3}{enter 2}") MsgBox(0+262144, "", ClipGet()) App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
dannyk Posted April 3, 2009 Share Posted April 3, 2009 Perhaps this helps: MsgBox(0+262144, "", "click OK to start a sample CMD window") $cmd = "ipconfig" Run(@ComSpec & " /k " & $cmd, "", @SW_SHOW) MsgBox(0+262144, "", "click OK to read the window to clipbox and show result") WinWaitActive("[CLASS:ConsoleWindowClass]") Send("!{space}{down 6}{right}{down 3}{enter 2}") MsgBox(0+262144, "", ClipGet()) Yes, this is helpful. After searching through the forums, someone suggested the ALT+SPACE > E > S > {Enter} method of capturing the text to the clipboard, which I believe is what you're illustrating above. Thank you for the quick response! Link to comment Share on other sites More sharing options...
Exit Posted April 3, 2009 Share Posted April 3, 2009 Yes, this is helpful. After searching through the forums, someone suggested the ALT+SPACE > E > S > {Enter} method of capturing the text to the clipboard, which I believe is what you're illustrating above. Thank you for the quick response!ALT+SPACE > E > S > {Enter} works fine on english locale, but other languages have other letters.For Germany it would be B(earbeiten) + A(lles markieren)My method is language independant, And even works in Windows 7. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2009 Moderators Share Posted April 3, 2009 http://www.autoitscript.com/forum/index.ph...lite=%2Bconsole 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...
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