Luciana Posted October 5, 2007 Posted October 5, 2007 Hello Everyone,I started yesterday using the Autoit tool. I need your help to finish a script. All I want it to do is to Copy a selection and past it in a text file. That´s how I´m trying to do it. Func CopyPastPrint() MouseClickDrag("left", 7, 27, 643, 315) ; Select the text area I want to copy Send("^c") ; Copy FileWrite($file, Send("^v") & @CRLF) ; Paste the selection in a Text FileEndFunc Can anyone tell me what I'm doing wrong here?If this question is too easy, I have another thing I have to do beside this. I have to see if the last 3 characters of this selection is equal to "END". Any clue will be very welcome!!!Thanks to all!!!Luciana Cantarelli
PsaltyDS Posted October 5, 2007 Posted October 5, 2007 What goes wrong? Does anything happen at all? Have you opened the file for write before writing to it? What triggers your function? As for "END": If StringRight($sText, 3) = "END" Then MsgBox(64, "End", "The End.") Changing '=' to '==' would make it case sensitive. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Moderators SmOke_N Posted October 5, 2007 Moderators Posted October 5, 2007 What is this?FileWrite($file, Send("^v") & @CRLF)oÝ÷ Ù:òjëh×6FileWrite($file, ClipGet() & @CRLF) 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.
Luciana Posted October 5, 2007 Author Posted October 5, 2007 This code is part of a very large program. I just made it simple to post here. The code:Send("^c") ; ^c should be Ctrl-C commandFileWrite($file, Send("^v") & @CRLF) ; ^v should be Ctrl-V command. The file is opening ok, there is no error regarding to the file. I tried to use the ClipGet() function instead of Send("^v") , but it does not return the selection obtained during the Send("^c") command --it puts in the file others things that I have in my clipboard.I was thinking in use the ClipPut() instead of Send("^c") to copy the selection otained during the MouseClickDrag(), but it doesn't work (or I don't know how to make it work).Thanks for the replies!!!!Luciana Cantarelli
Moderators SmOke_N Posted October 5, 2007 Moderators Posted October 5, 2007 I don't know why you are doing what you are doing... or what data you are trying to get... Personally, I would probably just use ControlGetText or WinGetText and parse the strings that way... but to each their own.If your clipboard has data... then clear it before calling Send("^c").ClipPut("")Send("^c")FileWrite($file, ClipGet() & @CRLF)The way you have it now with Send("^v") and FileWrite absolutely will not work. 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.
PsaltyDS Posted October 5, 2007 Posted October 5, 2007 What is the app window you are selecting stuff from? If it's an IE window, or a game, Flash window, or several other types of apps, that technique may never work. If you manually highlight with the mouse, and then manually use ctrl-c/ctrl-v to copy/paste, does it work? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Luciana Posted October 5, 2007 Author Posted October 5, 2007 Hi! The purpose of what I´m doing is that my boss asked me to extract 225 reports from cobol system that is accessed using telnet. This system is descentralized and any report development would cost a lot of money to us. I know this report is extracted following easy and the same steps. That's why I want to do it using the Autoit. I actually did all the steps until the selection of the text, I just need to copy the selected text (from telnet) into a text file. This if the final result is this text file with all 225 screen one below the other. I did what you recommended but it still didn´t work. Atc., Luciana Cantarelli
Luciana Posted October 5, 2007 Author Posted October 5, 2007 (edited) PsaltyDS, That´s what i was doing right now. I notice that sometimes de Ctrl-C works - sometimes it doen´t. Sometimes the Ctrl-INS (same thing as Ctrl-C) works, sometimes it doesn't. I have no clue why it's been so instable. The app is that black promt Widowns screen (like DOS but runing the telnet.exe). You can try... go in Start > Run > telnet. Thanks! Edited October 5, 2007 by Luciana
Moderators SmOke_N Posted October 5, 2007 Moderators Posted October 5, 2007 Have you tried ControlSend("Window Title Or Handle", "", "", "^c") after the drag? 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.
PsaltyDS Posted October 5, 2007 Posted October 5, 2007 PsaltyDS,That´s what i was doing right now. I notice that sometimes de Ctrl-C works - sometimes it doen´t. Sometimes the Ctrl-INS (same thing as Ctrl-C) works, sometimes it doesn't. I have no clue why it's been so instable.The app is that black promt Widowns screen (like DOS but runing the telnet.exe). You can try... go in Start > Run > telnet.Thanks!Console telnet client?! Egad!! Any chance you could just turn on logging in the telnet client, and parse the resulting file after you display all the required data? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Luciana Posted October 5, 2007 Author Posted October 5, 2007 (edited) hummm A lot of new information!!! Thanks!!! 1) How do I turn on the telnet logging? 2) What´s Egad? 3) Once I finish it all I´ll post as Script Example. 4) I attached the report I want to copy and past on a text file. Sorry this in portugues but you can have a clue. Thanks!!! Luciana Edited October 5, 2007 by Luciana
PsaltyDS Posted October 5, 2007 Posted October 5, 2007 hummm A lot of new information!!! Thanks!!! 1) How do I turn on the telnet logging? Depends on the version of windows/telnet client you are using, but something like: TELNET -f C:\Temp\Telnet.log telnet.server.com 2) What´s Egad? You don't know? Egad! 3) Once I finish it all I´ll post as Script Example. 4) I attached the report I want to copy and past on a text file. Sorry this in portugues but you can have a clue. That looks very much like you might be able to parse the file after the fact. Perhaps much quicker and easier than trying to automate the telnet console window itself. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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