susb8383 Posted March 3, 2011 Share Posted March 3, 2011 Hi, Newbie here. (Sorry about that!) I'm trying to copy text in a window that I have open. I figured out how to: Make the window be my active window search for the occurrence of the text I want but I'm having trouble figuring out how to highlight the text so that I can send a control C. I tried using the mouseclickdrag function, but it sees my mouse as being in my Windows folder where I just double-clicked the script to run, not in the active window that contains the text. So how do I grab the text from the window? Do I have to move my mouse to the active window (if so how?) or is there another way to highlight text without moving my mouse there? TIA, Susie Link to comment Share on other sites More sharing options...
exodius Posted March 3, 2011 Share Posted March 3, 2011 Try WinGetText or ControlGetText Link to comment Share on other sites More sharing options...
susb8383 Posted March 3, 2011 Author Share Posted March 3, 2011 So...just to make sure I get the basic concept... I have an email that has a bunch of text in it, and then: Name: John Doe I'm trying to copy 'John Doe' to the clipboard. So I thought I had to maneuver to the beginning of John by using Find, etc. and then somehow copy it. But it looks like the Win or Control GetText functions will give me the text of the entire window. So are you saying that the way to do it is to grab all the text of the window and then somehow get John Doe out of it? If so, how do I parse through the text? I assume I save it to a variable first. Or is there a different way I should be doing this? Thanks, Susie Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 3, 2011 Share Posted March 3, 2011 .. how do I parse through the text?Functions such as StringSplit or _StringExplode could be useful here. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
susb8383 Posted March 4, 2011 Author Share Posted March 4, 2011 Hi, Ok, the first part is working. I have all the data I want stored into variables. So now I'm trying to paste into forms on a web page. I can't quite get it to work. First of all, when I use AutoIt Window Info it shows me that all of the input fields on the web page have the same control id. The only thing that varies are the x y coordinates. So I tried ControlFocus("window title", "", "[X:597;Y:240]") Send ($firstname) The problem is that the first line does not put my cursor in the input field I want. Instead my cursor is wherever it happened to be the last time I clicked on the fields of the window. If I clicked on the last field and then ran the script, it puts the text in the last field. (The coordinates are for the first field). Any advice? I'm pretty close to getting it working, I think. Just don't know the correct procedure for pasting into a form. Thanks, Susie Link to comment Share on other sites More sharing options...
susb8383 Posted March 15, 2011 Author Share Posted March 15, 2011 Anybody? Link to comment Share on other sites More sharing options...
evilertoaster Posted March 15, 2011 Share Posted March 15, 2011 If it's a matter of putting it into a web form, it's usually easier to use the _IE UDFs (See the HelpFile)....assuming you're using Internet Explorer. _IEAttach() _IEGetObjById() and _IEFormElementSetValue() Are the relevant functions I think... Link to comment Share on other sites More sharing options...
susb8383 Posted March 15, 2011 Author Share Posted March 15, 2011 I'm using Firefox. I noticed that when I click in the form that already has text in it, AutoIt Window Info shows nothing as visible text. But if I use ControlSetText to put "blah" in there, "blah" shows as visible text in the window info, but it doesn't match what I see on my screen. Weird. Link to comment Share on other sites More sharing options...
evilertoaster Posted March 15, 2011 Share Posted March 15, 2011 Firefox also has a UDF for automation you might want to try: I'd tend to use the browsers API rather than the windows API given the option. There's also an activeX option: but it seems to be less reliable. Link to comment Share on other sites More sharing options...
susb8383 Posted March 15, 2011 Author Share Posted March 15, 2011 Thanks. I just poked around with IE. That works; was able to read the values and set the values. So if I can't get Firefox to work, at least I have something to fall back on. I also think that my Roboform browser plugin was adding extra complexity so I disabled it temporarily. Thanks! --Susie 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