gimx Posted February 15, 2009 Posted February 15, 2009 (edited) Hello, I want to get links and open a new IE window only if the text link is "p/stats". $oIE = _IECreate($url) $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.innerText = "p/stats" Then $oIEstats = _IECreate($oLink.href) MsgBox(0, "Link", $oLink.innerText & " - " & $oLink.href) _IEQuit($oIEstats) EndIf Next This code works and i see the msgbox with text and href. But it open all links and not only the link with the specific text Need help please, where i fail ? Thx Edited February 16, 2009 by gimx
Moderators SmOke_N Posted February 15, 2009 Moderators Posted February 15, 2009 (edited) Hello, I want to get links and open a new IE window only if the text link is "p/stats". $oIE = _IECreate($url) $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.innerText = "p/stats" Then $oIEstats = _IECreate($oLink.href) MsgBox(0, "Link", $oLink.innerText & " - " & $oLink.href) _IEQuit($oIEstats) EndIf Next This code works and i see the msgbox with text and href. But it open all links and not only the link with the specific text Need help please, where i fail ? Thx Just because you quit IE doesn't mean that the links aren't still in memory in the loop. After _IEQuit(), put ExitLoop. Edit: Actually, what's up with the _IECreate() in the loop? Edited February 15, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
CodyBarrett Posted February 15, 2009 Posted February 15, 2009 are you looking for if the text says that, or if it INCLUDES that + afew more letters the latter could be used by Stringinstr() and stringtrimleft() hwat exactly are you looking for? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
gimx Posted February 15, 2009 Author Posted February 15, 2009 Thx for replies.Imagine you have a webpage like this :<a href="http://blablabla.com">blablabla</a> <a href="http://poopoopidoo.com">poopoopidoo</a> <a href="http://blablabla.com">blablabla</a> <a href="http://poopoopidoo.com">poopoopidoo</a> <a href="http://blablabla.com">blablabla</a>I want to get the link only if the text is "blablabla"Actually if i use this code, autoit get all links and msgboxs appear with all links.The first msgbox say : blablabla - http://blablabla.comThe second : poopoopidoo - http://poopoopidoo.comEtc...But i want only msgbox with blablabla like this.The first msgbox say : blablabla - http://blablabla.com (click ok, loop continue an 2nd appear)The second msgbox say : blablabla - http://blablabla.com (click ok)The third : blablabla - http://blablabla.com (click ok, loop finish)$oIE = _IECreate($url) $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.innerText = "blablabla" Then MsgBox(0, "Link", $oLink.innerText & " - " & $oLink.href) EndIf Next
gimx Posted February 16, 2009 Author Posted February 16, 2009 Solved with String function. If String($oLink.innerText) = "blablabla" Then Or If StringInStr($oLink.innerText, "blablabla") Then Depend what you want. Thx for replies
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