eskay Posted November 21, 2007 Share Posted November 21, 2007 Im trying to click a link in a website.. The only problem is that its named "Reply" and each post on the forum has "Reply" in it. So the webpage has tons of "Reply" links but I want to click on the last one. So how can I search and click the Last "Reply" link that is found? Link to comment Share on other sites More sharing options...
BrettF Posted November 21, 2007 Share Posted November 21, 2007 Im trying to click a link in a website.. The only problem is that its named "Reply" and each post on the forum has "Reply" in it. So the webpage has tons of "Reply" links but I want to click on the last one. So how can I search and click the Last "Reply" link that is found?Look at the _IE functions. Then see how you go about finding the links. The other part can come later Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 21, 2007 Moderators Share Posted November 21, 2007 Here is an example... #include <IE.au3> $sURL = "http://www.msn.com/" $sSearchText = "photo" $oIE = _IECreate($sURL) _IELinkClickLast($oIE, $sSearchText) If @error Then MsgBox(0, "", "No links matched your search string.") EndIf Func _IELinkClickLast(ByRef $o_object, $s_SearchText) $o_Links = _IELinkGetCollection($o_object) $i_Count = @extended For $i = ($i_Count - 1) To 0 Step - 1 $s_LinkText = String($o_Links.item($i).outerText) If StringInStr($s_LinkText, $s_SearchText) Then _IELinkClickByIndex($o_object, $i) Return 1 EndIf Next Return SetError(1, 0, 0) EndFunc ;==>_IELinkClickLast Link to comment Share on other sites More sharing options...
DaleHohm Posted November 21, 2007 Share Posted November 21, 2007 Elegant and Cool! 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...
Moderators big_daddy Posted November 21, 2007 Moderators Share Posted November 21, 2007 Elegant and Cool!Thanks Dale! 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