shutch00 Posted May 17, 2012 Share Posted May 17, 2012 (edited) This has me stumped. I've checked help files and google and have no idea how to do this. My script is going down a column of text on a web page. It copies the text to the clip board, reads it, and depending on what the text says performs an action. The problem is that the text is not always in the exact same location; some times its on (260, 370), sometimes its on (265, 375) and so forth. Because of this, I have to get the coordinates manually before running my script each time, then make adjustments. Is there a way to have autoit search for the text and capture its coordinates before moving on with the rest of the script? Edited May 17, 2012 by shutch00 Link to comment Share on other sites More sharing options...
water Posted May 17, 2012 Share Posted May 17, 2012 What have you coded so far? Did you have a look at the IE UDF that comes with AutoIt? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
shutch00 Posted May 17, 2012 Author Share Posted May 17, 2012 The script is done except for this part. The way it works right now, I get the location of the word AKA starting point and plug it into variables x and y #include <IE.au3> $oIE = _IEAttach("home") $x = 260 ;X COORD STARTING POSITION $y = 365 ;Y COORD STARTING POSITION $x2 = $x-90 $x3 = $x-63 WinActivate("WEBPAGE GOES HERE") MouseClick("left",$x,$y,3) sleep(1000) $Clipboard = ClipGet() So I am using the AU3Info Finder tool to capture the coordnates of the word and then I plug it in above. It would be nice if Autoit could find the word, get its coords and plug it in for me. I've checked the IE UDF and tried a few things but was unsuccessful. Link to comment Share on other sites More sharing options...
water Posted May 17, 2012 Share Posted May 17, 2012 The word you are looking for is a link you want to click on? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
shutch00 Posted May 17, 2012 Author Share Posted May 17, 2012 No, unfortunately. It is simply text. It is for a web app that I am supporting. We have picklist items that need deleted if they do not match a certain criteria. My script crawls down the page, reads the picklist item and decides whether or not to delete it. The picklists are setup for different accounts, so I have to go into each account and run my script. The issue occurs when I go to a new account's page, because the text is moved slightly. Sorry if this is confusing. And thanks for your input. Link to comment Share on other sites More sharing options...
shutch00 Posted May 17, 2012 Author Share Posted May 17, 2012 Here is a mock up of the site (can't use the real thing) Link to comment Share on other sites More sharing options...
JohnOne Posted May 17, 2012 Share Posted May 17, 2012 This is a job for IE UDF without a doubt. 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...
shutch00 Posted May 18, 2012 Author Share Posted May 18, 2012 I'll keep looking, thanks. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 18, 2012 Moderators Share Posted May 18, 2012 Hi, shutch00. In the IE UDF you'll find _IEBodyReadHTML and _IEBodyReadText. Do you know what the text is going to be (i.e. either "a" or "b") or were you thinking of needing StringRegExp to compare a number of values? If you expect the text to always be the same, or only one or two variants, you should be able to read the source of the page and then perform your action, regardless of where it exists on the page itself. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
shutch00 Posted May 18, 2012 Author Share Posted May 18, 2012 The starting point will always be the same, so I assume that is all I need. From there, I just go down the page by increments. I will definitely check these out, thanks! Link to comment Share on other sites More sharing options...
water Posted May 18, 2012 Share Posted May 18, 2012 Is the text you are looking for just simple text or embedded in an object that has a name or an id? Could you post the html code of a line you need to search? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
shutch00 Posted May 18, 2012 Author Share Posted May 18, 2012 (edited) Here is a snippet of the html. Looking for the word time_code. That is the start position. <div> <table border="0" cellspacing="0" cellpadding="3" width="100%"><tr><td class="detailColHeader" nowrap="nowrap"> </td><td class="detailColHeader" nowrap="nowrap">[color=#ff0000]time_code[/color] </td><td class="detailColHeader" nowrap="nowrap">Description </td><td class="detailColHeader" nowrap="nowrap">Time/Shift Count </td> **Edited the code. Edited May 18, 2012 by shutch00 Link to comment Share on other sites More sharing options...
water Posted May 18, 2012 Share Posted May 18, 2012 You could try _IETableGetCollection to access the table that contains the data you need. Then use _IETableWriteToArray to write the content to an array. Then it's pure AutoIt to process the data the way you need. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
shutch00 Posted May 18, 2012 Author Share Posted May 18, 2012 So I've got the table written into an array, but I'm not understanding how to get the screen coords from that. Or are you saying to just navigate via the table. I may have gone over my head with this one. I'll have to do some research. Link to comment Share on other sites More sharing options...
jdelaney Posted May 18, 2012 Share Posted May 18, 2012 (edited) If you can get the object that the text is in (the lowest level element), then you can get the starting X,Y by doing the following (the x,y is inside the client of the browser): $iStartX = $oObj.offsetHeight $iStartY = $oObj.offsetLeft and then width, heighth by: $iHeight = $oObj.offsetTop $iWidth = $oObj.offsetWidth edit: just realized i missinterpreted your issue...you can perform _ieaction to click on the Dom element you find, so you don't need the X,Y, you just need to drill down to the <td> to read the data, and then move to a sibling <td> to perform an action, such as click link = delete...is that what you are shooting for? Edited May 18, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
JohnOne Posted May 18, 2012 Share Posted May 18, 2012 You shouldn't start farting around with mouseclicks now you are this far. Take a look at _IEPropertyGet() and specifically innertext. 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...
czardas Posted May 19, 2012 Share Posted May 19, 2012 (edited) Using mouse click coordinates is a bad idea for several reasons: differences in screen resolution, between browsers and scroll bar positioning. Edited May 19, 2012 by czardas operator64 ArrayWorkshop 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