Arclite86 Posted January 23, 2014 Posted January 23, 2014 how to find element or object by link this is the only information that i got: <a class="js-nav" href="/followbacklist3/followers" data-nav="followers" data-is-compact="false" data-element-term="follower_stats">Volgers<strong title="829">829</strong></a> and i want to use this code with this function,showing the value the followers that is 829 $oIE = _IECreate("https://twitter.com/followbacklist3") Local $oInputs = _IETagNameGetCollection($oIE, "a") For $oInput In $oInputs StringInStr($oInput.innertext, "volgers") Next MsgBox(0, "Twitter joesoef",$oInputs) but this one is not working so i thought maybe i can track it with the link or something
michaelslamet Posted January 23, 2014 Posted January 23, 2014 Read the page code and then use _StringBetween to get the text. I am now on phone, could not write and test a code
vkrisz81 Posted January 23, 2014 Posted January 23, 2014 (edited) i am afraid i cant understand you.. you wana get the number value of the link.. you can reach the link be test it with your row stringinstr after is you must use innerText in my opinian and i think you can not typeout an objexct reference, because you oinput will be an object which point to an element of the element collection! and and: if you have only 1 link you may use this code, but if you have more links(i dont know twitter) you must store in an array the values or you must put the writeout function inside the loop. and of course you have to remove the exitloop statement than! but only if you have more records to check.. $oIE = _IECreate("https://twitter.com/followbacklist3") Local $oInputs = _IETagNameGetCollection($oIE, "a") Local $sInnervalue="" For $oInput In $oInputs if StringInStr($oInput.outerHtml, "volgers") then $sInnervalue=$oInput.innerText ExitLoop EndIf Next if $sInnervalue="" then consolewrite("There was no link!") MsgBox(0, "Twitter joesoef",$sInnervalue) Edited January 23, 2014 by vkrisz81
Arclite86 Posted January 23, 2014 Author Posted January 23, 2014 (edited) i am afraid i cant understand you.. you wana get the number value of the link.. you can reach the link be test it with your row stringinstr after is you must use innerText in my opinian and i think you can not typeout an objexct reference, because you oinput will be an object which point to an element of the element collection! and and: if you have only 1 link you may use this code, but if you have more links(i dont know twitter) you must store in an array the values or you must put the writeout function inside the loop. and of course you have to remove the exitloop statement than! but only if you have more records to check.. $oIE = _IECreate("https://twitter.com/followbacklist3") Local $oInputs = _IETagNameGetCollection($oIE, "a") Local $sInnervalue="" For $oInput In $oInputs if StringInStr($oInput.outerHtml, "volgers") then $sInnervalue=$oInput.innerText ExitLoop EndIf Next if $sInnervalue="" then consolewrite("There was no link!") MsgBox(0, "Twitter joesoef",$sInnervalue) im very new at this sorry for not understanding, could you please show me i can do this so i can learn and copy it on other project right now it is only showing the tekst "volgers" its not really about the link, i just want the followers number if there is a easier way please tell me Edited January 23, 2014 by Arclite86
JohnOne Posted January 23, 2014 Posted January 23, 2014 See if this helps. #include <IE.au3> $oIE = _IECreate("https://twitter.com/followbacklist3") Local $oInputs = _IETagNameGetCollection($oIE, "strong") For $oInput In $oInputs ConsoleWrite($oInput.title & @LF) Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
bogQ Posted January 23, 2014 Posted January 23, 2014 (edited) Under ie8 #include <IE.au3> #include <String.au3> $oIE = _IECreate("https://twitter.com/followbacklist3") $oInputs = _IETagNameGetCollection($oIE, "a") For $oInput In $oInputs If $oInput.className() = "js-nav" Then If StringInStr($oInput.innerHTML()), 'Volgers') Then;or Followers depends withc language your using ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them ExitLoop EndIf EndIf Nextedit: maybe i casted that string converts with no need but its my habit when working with ie, dont know why fixed Edited January 23, 2014 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Arclite86 Posted January 23, 2014 Author Posted January 23, 2014 Under ie8 #include <IE.au3> #include <String.au3> $oIE = _IECreate("https://twitter.com/followbacklist3") $oInputs = _IETagNameGetCollection($oIE, "a") For $oInput In $oInputs If $oInput.className() = "js-nav" Then If StringInStr($oInput.innerHTML()), 'Volgers') Then;or Followers depends withc language your using ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them ExitLoop EndIf EndIf Next edit: maybe i casted that string converts with no need but its my habit when working with ie, dont know why fixed thank you I'm almost there, your code: #include <IE.au3> #include <String.au3> $oIE = _IECreate("https://twitter.com/followbacklist3") $oInputs = _IETagNameGetCollection($oIE, "a") For $oInput In $oInputs If $oInput.className() = "js-nav" Then If StringInStr($oInput.innerHTML(), 'Volgers') Then;or Followers depends withc language your using ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them ExitLoop EndIf EndIf Next MsgBox(0, "number followers", $oInput.innerHTML) i get the followers number which im very happy with, but I also get some other text that I dont want: if i start this script i get the message: Volger<strong title="829">829</strong> is there a way that I can remover al the text and only get the numbers ( 1x 829 not 2 times) (volgers = followers in dutch )
Solution bogQ Posted January 23, 2014 Solution Posted January 23, 2014 (edited) look at scite console output and you will see that you already have code for that in script MsgBox(0, "number followers", _StringBetween($oInput.innerHTML(),'>','<')[0]) Edited January 23, 2014 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Arclite86 Posted January 23, 2014 Author Posted January 23, 2014 MsgBox(0, "number followers", _StringBetween($oInput.innerHTML(),'>','<')[0]) Thank you so much!!
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