hvymetal Posted August 25, 2004 Share Posted August 25, 2004 Is there anyway to copy the full text from a dos window to the clipboard. There should be a way since it is possible do it manual using the mouse to select the window and copying to the clipboard. I want to be able to copy all the text in the dos window to parse it for certian pharses to use as feedback in my scripts. Since Autoit has the abiltiy to send keys to the dos window it should also have a way look for feedback whats going in the running program. The program that I'm using stays open so I can't just pipe the output to a text file. The program runs in a dos window and is all text based so when I manually copy and pasted it using the mouse to notepad all the information is in text form. I tried to search the forum and did not have any luck on coming up with any answers. So if someone could suggest a way I would be very thankfull. Link to comment Share on other sites More sharing options...
this-is-me Posted August 25, 2004 Share Posted August 25, 2004 (edited) Do you need it for 9x or 2k/xp? on 2k/xp: Send("!{space}") Send("e") Send("s") Send("{enter}") Edited August 25, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
hvymetal Posted August 26, 2004 Author Share Posted August 26, 2004 That will work. I just wish it didn't show the menu bar popping up. In any case it will work just not as hidden as I like it to be. Thanks for the tip. Link to comment Share on other sites More sharing options...
hvymetal Posted August 26, 2004 Author Share Posted August 26, 2004 Ok it didn't work completely. It only selects the first line and not the full dos box window. I tried using the Mark command in the window and and sending controlsend("C:\","","","!{space}ek") controlsend("C:\","","","{SHIFTDOWN}{PGDN}{RIGHT 80}{SHIFTUP}{ENTER}") but for some reason the {SHIFTDOWN} does not work. Link to comment Share on other sites More sharing options...
mcfr1es Posted August 26, 2004 Share Posted August 26, 2004 (edited) Ok it didn't work completely. It only selects the first line and not the full dos box window. I tried using the Mark command in the window and and sending controlsend("C:\","","","!{space}ek") controlsend("C:\","","","{SHIFTDOWN}{PGDN}{RIGHT 80}{SHIFTUP}{ENTER}") but for some reason the {SHIFTDOWN} does not work. <{POST_SNAPBACK}>its {SHIFT down} {SHIFT up} treat the "ups" and "downs" as if they were numbers (ie.) see your "{right 80}" Edited August 26, 2004 by mcfr1es Roger! You son of a big pile o' Monkey Nuts. Link to comment Share on other sites More sharing options...
CyberSlug Posted August 26, 2004 Share Posted August 26, 2004 (edited) its {SHIFT down} {SHIFT up}treat the "ups" and "downs" as if they were numbersAccording to the docs and my testing, it should be one word "{SHIFTDOWN}"P.S. From the ControlSend docs: Note, this function cannot send all the characters that the usual Send function can (notably ALT keys) but it can send most of them--even to non-active or hidden windows! I believe there were also some issues with ControlSend and shift. Edited August 26, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
hvymetal Posted August 26, 2004 Author Share Posted August 26, 2004 (edited) CyberSlug You were right I replaced the ControlSend with Send and it worked correctly. So if anyone wonders what I used here it is. WinActivate ( "C:\") send("!{space}ek{SHIFTDOWN}{PGDN}{RIGHT 80}{SHIFTUP}{ENTER}") I just wished that there was a key like PGDN that would arrow over with one key and not using "{right 80}". The reason is that you can see the selection scan across the screen in the dosbox. So if anyone knows a better way I'm willing to listen. All in all it works but I wish that Autoit had a way of getting the text from a dosbox built in. It would help out in the automation of Dos programs. Edited August 26, 2004 by hvymetal Link to comment Share on other sites More sharing options...
frogonalog Posted August 26, 2004 Share Posted August 26, 2004 (edited) Do you need the entire screen or just the results of the command? Couldn't you just redirect the the output to a file? If you still need to display on the dos screen then do a type to the file right below the command. Use > to create or overwrite a file. If you wanted to append to the file use >> Example: RunWait(@COMSPEC & " /c ping google.com > C:\ping.txt") RunWait(@COMSPEC & " /c type C:\ping.txt") Edited August 26, 2004 by frogonalog The world is flat - Class of 1492 Link to comment Share on other sites More sharing options...
hvymetal Posted August 26, 2004 Author Share Posted August 26, 2004 Frogonalog, As I said in my orginal post the dos program stays open. So you can not just pipe it to a file. That only works on programs that run once and then exit. The program that I'm trying to automate is an OLD dos based PLC software. I want to be able to automate the process of downloading the program to the PLC. To automate it correctly I need status that I have serial commucation to the device. This information is showed on the screen so my idea is keep copying the screen and parse the result to look for the keywords if everything is ok. Link to comment Share on other sites More sharing options...
frogonalog Posted August 27, 2004 Share Posted August 27, 2004 Frogonalog, As I said in my orginal post the dos program stays open. So you can not just pipe it to a file. That only works on programs that run once and then exit. The program that I'm trying to automate is an OLD dos based PLC software. I want to be able to automate the process of downloading the program to the PLC. To automate it correctly I need status that I have serial commucation to the device. This information is showed on the screen so my idea is keep copying the screen and parse the result to look for the keywords if everything is ok. <{POST_SNAPBACK}>Sorry, you would think that I would have learned to read by now :"> I was also thinking that an API call to PeekNamedPipe using VB or vbscript and writing to a file could be done, but it sounds like you have it figured out. The world is flat - Class of 1492 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