Sign in to follow this  
Followers 0
AzKay

Parse results to arrays?

7 posts in this topic

#1 ·  Posted (edited)

My new project, Yes, I had an idea.

Is going to be a script that will search a phonebook of the selected country, and return the information to a listview. What do I want to know? I want to know how to do this step:

Source To Array. Basically. The link posted below, has the information I want to set into arrays. Or variables.

( $address, $name, $number ) Or something similiar.

// Removed, Too much. See the link's source.

All that code is probly pissing you off. So, Heres the link, Incase you rather the link.

http://www.whitepages.com.au/wp/resSearchA...p;Search=Search

Which I would later have to adapt to other sites.

http://www.thephonebook.bt.com/publisha.co...cation=somerset

And a whole bunch of others. Wont this be fun?

No, Im not asking for someone to do it for me. Im asking for pointers.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



are you using IE or are you just doing Inetget?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

are you using IE or are you just doing Inetget?

WinHttpRequest, So yeah, Basically an INetGet.

Something like

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
            $oURL = "http://www.whitepages.com.au/wp/resSearch.do?" _
            & "subscriberName=" & GUICtrlRead($Surname) _
            & "&givenName=" & GUICtrlRead($Init) _
            & "&state=" & $caseState _
            & "&suburb=" & GUICtrlRead($PostCode) _
            & "&street=" & GUICtrlRead($StreetName) _
            & "&Search=Search"
            InputBox("", "", $oURL, "", 100, 10)
            $oHTTP.Open("POST", $oURL)
            $oHTTP.Send()
            $HTMLSource = $oHTTP.Responsetext

$HTMLSource being the source. Ofcourse.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I think ive got it. I tryed using StringRegExp(), After seeing Smoke using it, And thought it might help. So, I got the newest beta, Checked it out, and just edited the example abit and got:

$nOffset = 1
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
            $oURL = "http://www.whitepages.com.au/wp/resSearch.do?" _
            & "subscriberName=" & "antonopoulos" _
            & "&givenName=" & "" _
            & "&state=" & "NSW" _
            & "&suburb=" & "" _
            & "&street=" & "" _
            & "&Search=Search"
$oHTTP.Open("POST", $oURL)
$oHTTP.Send()
$HTMLSource = $oHTTP.Responsetext

While 1
    $array = StringRegExp($HTMLSource, '<li class=''entryData address''>(.*?)</li>', 1, $nOffset)
    
    If @error = 0 Then
        $nOffset = @extended
    Else
        ExitLoop
    EndIf
    for $i = 0 to UBound($array) - 1
        msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i])
    Next
WEnd

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think ive got it. I tryed using StringRegExp(), After seeing Smoke using it, And thought it might help. So, I got the newest beta, Checked it out, and just edited the example abit and got:

$nOffset = 1
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
            $oURL = "http://www.whitepages.com.au/wp/resSearch.do?" _
            & "subscriberName=" & "antonopoulos" _
            & "&givenName=" & "" _
            & "&state=" & "NSW" _
            & "&suburb=" & "" _
            & "&street=" & "" _
            & "&Search=Search"
$oHTTP.Open("POST", $oURL)
$oHTTP.Send()
$HTMLSource = $oHTTP.Responsetext

While 1
    $array = StringRegExp($HTMLSource, '<li class=''entryData address''>(.*?)</li>', 1, $nOffset)
    
    If @error = 0 Then
        $nOffset = @extended
    Else
        ExitLoop
    EndIf
    for $i = 0 to UBound($array) - 1
        msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i])
    Next
WEnd
There a _StrBetween() function I wrote in the scripts and scraps Azkay. Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There a _StrBetween() function I wrote in the scripts and scraps Azkay.

Yeah, Ive used that before. I guess I forgot about it. Well, Seeing as im having a bunch of problems

with this one, For some reason, half of the "name" is returning the same, etc. I think it might work better with

_StrBetween. Hehe. Well, Ill do it when I wake up. Thanks.

EDIT::

Oh yeah, I think the reason I didnt use _StrBetween, Was because, Theres more than one occurence of the thing im searching between.

So, How would I do it with _StrBetween? Store the values in Arrays? If so. That wont be much good. Im no good at arrays.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Yeah, Ive used that before. I guess I forgot about it. Well, Seeing as im having a bunch of problems

with this one, For some reason, half of the "name" is returning the same, etc. I think it might work better with

_StrBetween. Hehe. Well, Ill do it when I wake up. Thanks.

EDIT::

Oh yeah, I think the reason I didnt use _StrBetween, Was because, Theres more than one occurence of the thing im searching between.

So, How would I do it with _StrBetween? Store the values in Arrays? If so. That wont be much good. Im no good at arrays.

Hmm, and how do you expect to get multiple values without an array... Eval()?

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0