gfcaim Posted May 5, 2010 Share Posted May 5, 2010 Looking for someone to stir my imagination! I'm trying to select a text field on a web page. The problem is it could move posotion depending on if the fields above it wrap to become multi-line. Currently i'm searching on a pixel color (using the following) with some success, but no scientific accuracy! $coord=PixelSearch(450,650,460,685,0xB7CCE3) if isarray($coord) then mouseclick("main",$coord[0],$coord[1]-20,1) Else msgbox(0,"Fail","pixel not found") exit endif Window info doesn't give me much help as the contol has nothing specific that I can code to. Any ideas? [font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font] Link to comment Share on other sites More sharing options...
JohnOne Posted May 5, 2010 Share Posted May 5, 2010 (edited) If you were to use the IE.au3 UDFs functions, which are included in the autoit3 download, you will get much better results. For instance, the field you mention may change slight postion but its unlikely to change its name, and you can select it by its name. There is also a similar UDF for firefox FF.au3. It may take you a little while to get the hang of, but a few forum searches will have you started in no time and you will have a much more reliable method of achieving your goal than pixelsearching. EDIT: I think the add on for firefox to inspect the webpage is called firebug. Off the top of my head I cannot remember what is used for IE, but nevertheless the field and object names remain the same. Edited May 5, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gfcaim Posted May 5, 2010 Author Share Posted May 5, 2010 (edited) Brilliant - thanks for the reply - it sets me off in a direction now... Edited May 5, 2010 by gfcaim [font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font] Link to comment Share on other sites More sharing options...
gfcaim Posted May 5, 2010 Author Share Posted May 5, 2010 Sorry to continue this, but I have been doing some searching/reading on this and still don't get how to get the element names - could someone please give me a pointer in th eright direction to a simple tutorial... [font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font] Link to comment Share on other sites More sharing options...
JohnOne Posted May 5, 2010 Share Posted May 5, 2010 what browser do you use ?Try Using DebugBar For IEOr search Firefox addons for FireBugWhen you install firebug addon, when you right click you will see a shell option for inspect element, for whichever you have the mouse over.Not sure how it works in DebugBar AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted May 5, 2010 Share Posted May 5, 2010 Heres a quick simple example of what you will need to be doing. #include <IE.au3> $oIE = _IECreate("www.google.com") $oForm = _IEFormGetObjByName ($oIE, "f") $oSearch = _IEFormElementGetObjByName ($oForm, "q") $oSubmit = _IEFormElementSetValue ($oSearch, "Autoit3") _IEFormSubmit ($oForm) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gfcaim Posted May 5, 2010 Author Share Posted May 5, 2010 Thanks so much John, I will go try to learn now! (BTW I'm using IE, not through choice but Corporate decision) [font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font] 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