Traciatim Posted March 15, 2005 Share Posted March 15, 2005 I'm using a key sequence (ALT-SPACE - Then E - Then S - Then Enter) to copy ifrom a DOS window. I then you ClipGet() to get the contents of the clipvoard, but when I display them it only displays a 1 (As in an error). I can follow the same key sequence and get the text and paste it in to notepad, so I'm wondering what I'm doing wrong with my AutoIt Script Traciatim Link to comment Share on other sites More sharing options...
Alterego Posted March 15, 2005 Share Posted March 15, 2005 here's a program i wrote that (while very shoddy) can work as a replacement for cmd.exe and will log everything. see also microsoft's webpage on command redirection operators.basically, say you wanted to ping someone and log the output, your autoit code would look like thisRunWait(@ComSpec & ' /c ping 127.0.0.1>C:\cmd.log.txt')Or if you want it to append to a log file you use two >>RunWait(@ComSpec & ' /c ping 127.0.0.1>>C:\cmd.log.txt')you can do other stuff with the output. read the ms page. gl This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Alterego Posted March 15, 2005 Share Posted March 15, 2005 by the way, the reason it doesn't behave as other windows do is that it not designed using typical gui methods. the reason for this is completely beyond me... This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Blue_Drache Posted March 15, 2005 Share Posted March 15, 2005 (edited) I'm using a key sequence (ALT-SPACE - Then E - Then S - Then Enter) to copy ifrom a DOS window. I then you ClipGet() to get the contents of the clipvoard, but when I display them it only displays a 1 (As in an error). I can follow the same key sequence and get the text and paste it in to notepad, so I'm wondering what I'm doing wrong with my AutoIt ScriptTraciatim<{POST_SNAPBACK}>Opt("WinTitleMatchMode",2) Run(@comspec) WinWait("cmd.exe") WinActivate("cmd.exe") Send("dir{enter}") Sleep(1500) Send("!{space}ES{enter}") MsgBox(0,"ClipBoard Contents",ClipGet())Displays the contents of the clipboard just fine for me. Edited March 15, 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...
DaveF Posted March 15, 2005 Share Posted March 15, 2005 Console redirection is probably the best way to do this, more options for doing so should be avaiable soon.N.B. that the full-on Unix-like redirection abilities aren't available on all Windows versions. Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
Alterego Posted March 15, 2005 Share Posted March 15, 2005 more options for doing so should be avaiable sooncan you explain this in more detail? are we going to be able to specify our autoit prog as a handle? This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Blue_Drache Posted March 15, 2005 Share Posted March 15, 2005 can you explain this in more detail? are we going to be able to specify our autoit prog as a handle?<{POST_SNAPBACK}>He's talking about COM functions currently in Alpha testing phase. There's a thread in the Dev section about it.... 3.1.0++ I believe... Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Alterego Posted March 15, 2005 Share Posted March 15, 2005 yeah i figured as much, but i don't understand how that is going to help with this. do you have a link to a good "com for someone who has no idea what com is a.k.a dummies" website? This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
DaveF Posted March 15, 2005 Share Posted March 15, 2005 yeah i figured as much, but i don't understand how that is going to help with this. do you have a link to a good "com for someone who has no idea what com is a.k.a dummies" website?Actually I was talking about console I/O redirection, lets you provide the console input and output for command line apps that you call with Run().Thread about it here with a link to download. Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
Alterego Posted March 15, 2005 Share Posted March 15, 2005 thats pretty slick. thanks. i could still use that com link if anyone has a resource they prefer This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Traciatim Posted March 15, 2005 Author Share Posted March 15, 2005 Sleep(1500) Send("!{space}ES{enter}") MsgBox(0,"ClipBoard Contents",ClipGet()) . . . this is almost exatly what I have, except I use $clipstuff = ClipGet() and then the MsgBox displays $clipstuff, which is always 1, no matter the contents of the DOS window... since I'm on a remote desktop connection, I have it pause slightly between the ALT+SPACE, then wait and hit E, then wait and hit S, then wait and hit ENTER. Still nothing yet, any other ideas? Link to comment Share on other sites More sharing options...
Alterego Posted March 16, 2005 Share Posted March 16, 2005 im not sure what you mean by still nothing yet...it's really easy to get the text. just use the > redirection operator and put it to a text file. then do _FileReadToArray, and then do _ArrayToString, and then do StringReplace for the delimiter you use in _ArrayToString. for example, you might use % as a delimiter, and then replace it with @CRLF so you have a regularly formatted file. then use ClipPut() to put your string, which is the cmd.exe text, on the clipboard. the program i linked to above does this. This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Traciatim Posted March 16, 2005 Author Share Posted March 16, 2005 I can't just take it out of a file because the file is 2 machines away, I connect to a server which then connects to a remote machine. I have to use the screen scrape to see what's on the screen since I can't get any window information from inside my original remote desktop connection. I can connect manually, and hit ALT-SPACE, E, S, ENTER, then open notepad and paste but if I do it like this: Sleep(1500) Send("!{space}ES{enter}") MsgBox(0,"ClipBoard Contents",ClipGet()) I get a message box that says 1 Link to comment Share on other sites More sharing options...
Blue_Drache Posted March 16, 2005 Share Posted March 16, 2005 (edited) I can't just take it out of a file because the file is 2 machines away, I connect to a server which then connects to a remote machine. I have to use the screen scrape to see what's on the screen since I can't get any window information from inside my original remote desktop connection. I can connect manually, and hit ALT-SPACE, E, S, ENTER, then open notepad and paste but if I do it like this:Sleep(1500)Send("!{space}ES{enter}")MsgBox(0,"ClipBoard Contents",ClipGet())I get a message box that says 1<{POST_SNAPBACK}>Try the redirection commands as posted previously.#Include <array.au3> Dim $file,$aFileArray Send("dir > c:\dir.txt{enter}") $file FileOpen(C:\dir.txt,0); open in read mode If $file = -1 then MsgBox(0x13,"Error","Unable to open file") _FileReadToArray($file,$aFileArray) Edited March 16, 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...
Traciatim Posted March 16, 2005 Author Share Posted March 16, 2005 Here is where the problem lies with that: Send("dir > c:\dir.txt{enter}") *** Can't write to drive, the machine that the DOS window is on is a server where we can't write or read to the drive. The connection goes: Local Machine (Remote Desktop) -> Win2K Server (Kermit) -> Linux Box at a Client I need to download a file on to the Linux machine from our FTP site and then know when it is complete to continue with extraction and installation. I was trying tu use a screen scrape to get when the FTP> prompt returns, but I keep getting 1 as the contents of the clip board. Link to comment Share on other sites More sharing options...
Alterego Posted March 16, 2005 Share Posted March 16, 2005 can you direct the log to a web accessible directory? if so, use @InetGetSize to ping it every once in a while for it's size in bytes, and if it doesn't change after say, 2-3 minutes, it's done. This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Traciatim Posted March 16, 2005 Author Share Posted March 16, 2005 Actually, I found it. I think it was caused by the lag between me and the server was it. I had to send it like: send("!{SPACE}") sleep(250) send("e") sleep(250) send("s") sleep(250) send("{ENTER}") sleep(250) and then it worked... Thanks for all the help. 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