Ashura Posted November 16, 2009 Share Posted November 16, 2009 I am creating a script to automate one of the tasks that need to be performed many times a day. What I need is to find a way to have a script find a word in the web page and click on the image that is used for the link. The link does not have any text in it. I have tried to find examples using both the _IEBodyReadText and _IEBodyReadHTML and I was unable to. I was not able to find any information in the forums on this. I do not have any code to share as I do not know where to start on this. Thanks, Ashura Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 16, 2009 Share Posted November 16, 2009 What text is the search word in? Is it part of the description (i.e. in the .title property of the IMG tag). You need to define what kind of element the search word is in, and what the relationship is between that element and the image link you want to click. 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 Link to comment Share on other sites More sharing options...
Ashura Posted November 16, 2009 Author Share Posted November 16, 2009 What text is the search word in? Is it part of the description (i.e. in the .title property of the IMG tag). You need to define what kind of element the search word is in, and what the relationship is between that element and the image link you want to click. The text and the image link are in the same TD tag, but there is no other connections between them then that(verified by checking the page source). I did notice that the links have a unique number in them to differentiate them from each other. Can this be used to follow the link? The unique number is 590 and it starts there everyday that I can see. If that can be used how would I go about that? This script is needed to check the page once an hour as the number of links can change. I do not know if the unique number is reused after the link goes invalid. I will add that latter after I verify it. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 16, 2009 Share Posted November 16, 2009 So you can search all TD tags until you find StringInStr($oTD.innertext, "SearchWord") to get a reference to that TD. You can loop through the collection of child elements of that TD ($oTD.childNodes) to find the IMG. It might be simpler, but I don't remember if you can just do _IEImgClick($oTD, "ImageName", "name") or _IEImgGetCollection($oTD, 0), specifying the $oTD as the parent to look under. 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 Link to comment Share on other sites More sharing options...
Ashura Posted November 16, 2009 Author Share Posted November 16, 2009 So you can search all TD tags until you find StringInStr($oTD.innertext, "SearchWord") to get a reference to that TD. You can loop through the collection of child elements of that TD ($oTD.childNodes) to find the IMG. It might be simpler, but I don't remember if you can just do _IEImgClick($oTD, "ImageName", "name") or _IEImgGetCollection($oTD, 0), specifying the $oTD as the parent to look under. Thanks for the help so far. I understand what your saying up until you say declare the parent as $oTD. I'm have trouble with the formatting of the Variable. Here is the Summary tab from the AutoIi v3 Window Information if it helps. >>>> Window <<<< Title: WorldWideWhiteboard SDK Dashboard Class: IEFrame Position: 1680, 0 Size: 1280, 1016 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x000E07F6 >>>> Control <<<< Class: Internet Explorer_Server Instance: 1 ClassnameNN: Internet Explorer_Server1 Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1] ID: Text: Position: 0, 118 Size: 1272, 841 ControlClick Coords: 213, 355 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x00020806 >>>> Mouse <<<< Position: 217, 503 Cursor ID: 2 Color: 0xFFFFFF >>>> StatusBar <<<< 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: >>>> Visible Text <<<< Navigation Bar (http removed) Address Combo Control Page Control Google Search Combo Control Search Control Command Bar Favorites Command Bar LinksBand Favorites Bar Add to Favorites Bar ITBarHost Menu Bar WorldWideWhiteboard SDK Dashboard Zoom Level >>>> Hidden Text <<<< Google Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 17, 2009 Share Posted November 17, 2009 Well, I'll back up a bit... The AU3Info stuff doesn't help because it's a web page in IE. If you want to work automation on that, you need to learn something about the Document Object Model (DOM) and how you can work with it using the _IE* functions of the IE.au3 UDF in the help file. The DOM is what a web page looks like to software, including AutoIt. The tags you see in the HTML from the page represent elements in the DOM. In your page, there is at least one table element, some table rows (TR elements) in the table, and in the rows there are table data elements (TD). If the text is simply inside the TD tags, i.e. "<TD>This is the text.</TD>", then $oTD would be an object reference to that TD tag, and $oTD.innertext is the property that contains that text. There can be other elements inside TD element, like an IMG image tag. The IMG tag would be a child node under the TD tag. There is a collection element (like an array) that contains all the child nodes under a given parent element. That would be $oTD.childNodes in this case. I was talking in the earlier post about ways you might look inside the TD parent element to find the text you wanted, and then the IMG tag you wanted. So, you have some studying to do. Take it in small parts and use the example scripts in the help file as a starting place. 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 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