RyGoTypE Posted June 17, 2005 Share Posted June 17, 2005 (edited) Is it possible to search a web page for specific text using autoit? Not using the browsers search function.... but search for the text (link) and click it. Edited June 17, 2005 by RyGoTypE http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
herewasplato Posted June 17, 2005 Share Posted June 17, 2005 Is it possible to search a web page for specific text using autoit?<{POST_SNAPBACK}>There are several ways to do that - if using IE, tab around and look at the status bar. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RyGoTypE Posted June 17, 2005 Author Share Posted June 17, 2005 Tab for the specific text link? how? http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
RyGoTypE Posted June 17, 2005 Author Share Posted June 17, 2005 I have another question. I used the code from the example structure and it is incorrect?; Find a #99FF99 pixel (Easy Fight) in the range 0,0-1024,768 $coord = PixelSearch(0, 0, 1024, 768, 0x99FF99) Send("{END}") If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIfError:Subscript used with non-Array variable.: MsgBox(0, "X and Y are:", $coord[0]& "," & $coord[1]) MsgBox(0, "X and Y are:", $coord^ ERROR http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
herewasplato Posted June 18, 2005 Share Posted June 18, 2005 (edited) Edit: I'll defer to DaleHohm's solution below... Edited June 18, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RyGoTypE Posted June 18, 2005 Author Share Posted June 18, 2005 Well, here is a screen shot.What I am trying to do in the script is, click the links to easy, or very easy fights.Sometimes Hard, very hard, and close fights will appear. http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
herewasplato Posted June 18, 2005 Share Posted June 18, 2005 Someone else in the forum might be willing to help you with another method of finding your desired link... later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
DaleHohm Posted June 18, 2005 Share Posted June 18, 2005 Someone else in the forum might be willing to help you with another method of finding your desired link... later<{POST_SNAPBACK}>Here's a function and an example I just wrote using COM to find and activate a link...$ObjIE = ObjCreate ("InternetExplorer.Application") With $ObjIE .Visible = True .Navigate ("http://www.autoitscript.com/") While .ReadyState <> 4 Sleep(50) WEnd EndWith clickLink($ObjIE, "forum", 2) Exit Func clickLink($obj, $searchText, $instance = 1) ; clickLink( $obj, $serachText [, $instance]) ; $obj - Object Valiable pointing to an InternetExplorer.Application object ; $searchText - the text displayed on the web page for the desired link to click ; [$instance] - if the link text occurs more than once, specify which instance you want to click (numbering starts at 1) $doc = $obj.document $links = $doc.links $found = 0 For $link in $links $linkText = $link.outerText If $linkText = $searchText Then $found = $found + 1 if ($found = $instance) Then $result = $link.click ExitLoop EndIf EndIf Next EndFunc ;==>clickLinkEnjoy!Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
RyGoTypE Posted June 18, 2005 Author Share Posted June 18, 2005 (edited) C:\Documents and Settings\Shizzkabiz\Desktop\random.au3(2,51) : ERROR: ObjCreate(): undefined function. $ObjIE = ObjCreate ("InternetExplorer.Application") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\Shizzkabiz\Desktop\random.au3 - 1 error(s), 0 warning(s) Edited June 18, 2005 by RyGoTypE http://www.shizzkabiz.com/ Link to comment Share on other sites More sharing options...
zwiebel Posted June 21, 2005 Share Posted June 21, 2005 Here's a function and an example I just wrote using COM to find and activate a link...$ObjIE = ObjCreate ("InternetExplorer.Application") With $ObjIE .Visible = True .Navigate ("http://www.autoitscript.com/") While .ReadyState <> 4 Sleep(50) WEnd EndWith clickLink($ObjIE, "forum", 2) Exit Func clickLink($obj, $searchText, $instance = 1) ; clickLink( $obj, $serachText [, $instance]) ; $obj - Object Valiable pointing to an InternetExplorer.Application object ; $searchText - the text displayed on the web page for the desired link to click ; [$instance] - if the link text occurs more than once, specify which instance you want to click (numbering starts at 1) $doc = $obj.document $links = $doc.links $found = 0 For $link in $links $linkText = $link.outerText If $linkText = $searchText Then $found = $found + 1 if ($found = $instance) Then $result = $link.click ExitLoop EndIf EndIf Next EndFunc ;==>clickLinkEnjoy!Dale<{POST_SNAPBACK}>How about to search a string in the web page which does not a link? Link to comment Share on other sites More sharing options...
ame1011 Posted June 21, 2005 Share Posted June 21, 2005 How about to search a string in the web page which does not a link?<{POST_SNAPBACK}> Just do a inetget and parse the text [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
zwiebel Posted June 21, 2005 Share Posted June 21, 2005 Just do a inetget and parse the text<{POST_SNAPBACK}>Thanks for response.But the situation is that, I need to browse to a page served by Tomcat and use "send tab" to fillin some text fields and submit. a new page would be loaded and return a status to me about the form submition. I just want to retrieve the return message when the page load complete, and then the script would continue to perform other actions.I tried before to access the form by using COM/DOM, but it seems that the script couldn't find and fillin anything. I am sure that I had put the url and form name, field names correct. Link to comment Share on other sites More sharing options...
herewasplato Posted June 22, 2005 Share Posted June 22, 2005 Thanks for response.But the situation is that, I need to browse to a page served by Tomcat and use "send tab" to fillin some text fields and submit. a new page would be loaded and return a status to me about the form submition. I just want to retrieve the return message when the page load complete, and then the script would continue to perform other actions.I tried before to access the form by using COM/DOM, but it seems that the script couldn't find and fillin anything. I am sure that I had put the url and form name, field names correct.<{POST_SNAPBACK}>If the "return message" is text, then a combination of "send tab" to fill in the form and plain old "ctrl-f" to find the text of interest might work. If the "return message" cannot be known ahead of time and therefore cannot be searched for, then try this strange option:fill in the formget the return in the browsercheck the URL of the returned page for info that you can key off ofand/orfeed that URL to InetGetand see if you get the same page to a filethen parse the file for the data.later [size="1"][font="Arial"].[u].[/u][/font][/size] 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