Medic873 Posted February 11, 2011 Share Posted February 11, 2011 okay I got this script out here and it worked great for another task but now when I apply it to this it is only pulling the letters and not the numbers with it. #include <WindowsConstants.au3> #include <IE.au3> $AccountLoginRetrive = _IECreate ("http://freetexthost.com/hsnfi4iztv", 1, 1, 1) _IELoadWait ($AccountLoginRetrive) $oDivID = _IEGetObjById($AccountLoginRetrive, "contentsinner") $AccountLogins = _IEPropertyGet($oDivID, "innertext") $AccountLogins = StringReplace(StringRegExpReplace($AccountLogins, "\d", ""), "This page has been viewed times", "") Sleep (600) _IeQuit ($AccountLoginRetrive); msgbox (1, "aa", $AccountLogins); Link to comment Share on other sites More sharing options...
Tvern Posted February 11, 2011 Share Posted February 11, 2011 This part StringRegExpReplace($AccountLogins, "\d", "") will have something to do with that. P.S. I think someone wrote an example using InetRead in the other topic. That'd be much faster then the IE UDF. Link to comment Share on other sites More sharing options...
Medic873 Posted February 11, 2011 Author Share Posted February 11, 2011 okay I have no problem with using the other script and it pulls the number but it will only pull the first account. how can I make this pull multiple #include<misc.au3> #include <ScreenCapture.au3> #Include<file.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <INet.au3> #include <String.au3> #Include <Array.au3> $aText = _StringBetween(_INetGetSource('http://freetexthost.com/hsnfi4iztv'), '<div id="contentsinner">', '<br />') ; http://freetexthost.com/xofx34vrvu MsgBox(0, '', $aText[0] & @LF) filewrite ("Accounts.txt", $aText[0]); filewrite ("Accounts.txt", $aText[1]); Link to comment Share on other sites More sharing options...
Tvern Posted February 11, 2011 Share Posted February 11, 2011 (edited) I'll have a look tomorrow. Shouldn't be too hard.Edit:This version should be practically identical in use to your IE version:#include <INet.au3> #include <String.au3> $sSource = _INetGetSource('http://freetexthost.com/hsnfi4iztv') If Not $sSource Then ConsoleWrite("Page could not be downloaded." & @CRLF) Exit EndIf $aText = _StringBetween($sSource, '<div id="contentsinner">', '<div'); http://freetexthost.com/xofx34vrvu If @error Then ConsoleWrite("Source did not contain expected content." & @CRLF) Exit EndIf $sAccounts = StringReplace($aText[0],"<br />","") MsgBox(0, '', $sAccounts & @LF) ;~ ;filewrite.I cheated a bit with the linebreaks. (just kept the linebreaks in the source, rather than remove those and replace <br /> with @CRLF) but the output seems to match that of your example.This version only grabs strings that match the pattern of two uppercase letters, followed by six digits, which seems to be the valid format. Other strings are ignored. (like the "LB" without numbers in there)#include <String.au3> #include <array.au3> $sSource = _INetGetSource('http://freetexthost.com/hsnfi4iztv') If Not $sSource Then ConsoleWrite("Page could not be downloaded." & @CRLF) Exit EndIf $aText = _StringBetween($sSource, '<div id="contentsinner">', '<div') ;this is to avoid false positives from other content on the page matching the AA###### pattern If @error Then ConsoleWrite("Source did not contain expected content." & @CRLF) Exit EndIf $aText = StringRegExp($aText[0], '([A-Z]{2}[0-9]{6})',3) ;get all the strings that constist out of two uppercase letters and 6 digits. If @error Then ConsoleWrite("Source did not contain expected content." & @CRLF) Exit EndIf _ArrayDisplay($aText) ;_FileWriteToArray can replace filewrite here,Someone might come up with a nice regex that will make the stringbetween unneeded, but it was too much of a hassle for me to try and figure it out.(In before GEOSoft plugs his PCRE Toolkit. Yes I do use that. Yes it's nice.)As a sidenote: "Account puller" might sound a bit illigalish to some, which might stop people from replying, so if you can explain how you intent to use this there might be more response to future help requests. Edited February 12, 2011 by Tvern 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