Guest sergio_bzh Posted February 4, 2005 Share Posted February 4, 2005 hi ! I've discovered yesterday AutoIt and it is a revelation for me ! At last an easy scritping methos for windows. I have already written a few scritps and particularly one script I run from Command prompt window. I have 2 problems (i've read the help but find nothing) : 1) How write to the console ? like 'echo' command 2) how to execute a DOS command which is not a file ? 'cd' or 'vol' for example ? I need to get the serial of the partition given by 'vol' command. Thanks a lot. Serge Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 4, 2005 Share Posted February 4, 2005 (edited) hi !I've discovered yesterday AutoIt and it is a revelation for me ! At last an easy scritping methos for windows. I have already written a few scritps and particularly one script I run from Command prompt window. I have 2 problems (i've read the help but find nothing) : 1) How write to the console ? like 'echo' command 2) how to execute a DOS command which is not a file ? 'cd' or 'vol' for example ? I need to get the serial of the partition given by 'vol' command.Thanks a lot.Serge<{POST_SNAPBACK}>I can help with that by way of an example script I gave for screen-scraping the dosbox.AutoItSetOption("WinTitleMatchMode",4) Run(@ComSpec & " /c " & "Cmd.exe"); open a dos box WinWait("classname=ConsoleWindowClass"); wait for it to open ControlSend("classname=ConsoleWindowClass","","","IPCONFIG -ALL{enter}"); send the command Sleep(500); wait a bit for the command to finish WinActivate("classname=ConsoleWindowClass"); make sure that our dos box has focus. Send("!{space}ES{enter}"); scrape the screen $clipboard = ClipGet(); put the contents of the clipboard into a variable. MsgBox(0,"Clipboard", $clipboard); display the contents of our variable.Now, just change IPCONFIG -ALL to something like VOL and you have the start of what you were looking for.You can also redirect the contents to a text file instead with VOL > volume.txt and then tinker with the file reading commands.Happy scripting! Edited February 4, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Guest sergio_bzh Posted February 4, 2005 Share Posted February 4, 2005 Thanks for you quick answer, it works but not at all : result is not copied in the clipboard : Send("!{space}ES{enter}"); doesn't seem to scrape the screen. ? Link to comment Share on other sites More sharing options...
scriptkitty Posted February 4, 2005 Share Posted February 4, 2005 might be your version of windows. Open a dos box, hold alt and hit space, then e then s and finally enter. This should select all the text and copy it into memory. Alternately, most of the time I use command lines I just have it save the result into a text file via the pipe command. ex: run(@comspec & ' /c dir >dir.txt') ; creates a text file with the directory output. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Guest sergio_bzh Posted February 4, 2005 Share Posted February 4, 2005 I think I will do it with redirection as you said. Thanks Link to comment Share on other sites More sharing options...
layer Posted February 4, 2005 Share Posted February 4, 2005 sykes when i did what you did my cmd window went really huge and the only way to get out was to type: exit lol FootbaG Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 5, 2005 Share Posted February 5, 2005 sykes when i did what you did my cmd window went really huge and the only way to get out was to type: exitlol <{POST_SNAPBACK}>I believe (on US systems) that ALT+ENTER will force the dos box from fullscreen back into windowed mode. Try that next time. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache 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