Sign in to follow this  
Followers 0
gamerman2360

GetMemberNames

3 posts in this topic

When I made this I was thinking of the Valuater's tutorial thing and the fourm's search function. I was wondering if there was a way to automatically fill in the member name (and, now, number) input field on the quiz thing like what happenes when you type in 3 letters in the member filter on the search page. I looked at the src for the search page and came up with this UDF.

$return = _AU3FourmGetMemberNames("game")

For $x = 0 To UBound($return) - 1
    For $y = 0 To UBound($return, 2) - 1
        If $return[$x][0] == "gamerman2360" And $y = 0 Then ToolTip(";)", 10, 10)
        MsgBox(0, $x & ", " & $y, $return[$x][$y])
        If $return[$x][0] == "gamerman2360" And $y = 1 Then ToolTip("")
    Next
Next

; _AU3FourmGetMemberNames($sSearch) by gamerman2360
Func _AU3FourmGetMemberNames($sSearch); Note: Takes 1.3 seconds aprox
    If StringLen($sSearch) < 3 Then Return SetError(1); Must be at least 3 letters
    
    $s_IEString = $sSearch; Make IECapable
    Local $s_IEReturn
    For $i_IECount = 1 To StringLen($s_IEString); From _INetExplorerCapable() by Wes Wolfe-Wolvereness
        $n_IEChar = Asc(StringMid($s_IEString, $i_IECount, 1))
        If $n_IEChar < 0x21 Or $n_IEChar = 0x25 Or $n_IEChar = 0x2f Or $n_IEChar > 0x7f Then
            $s_IEReturn &= '%' & Hex($n_IEChar, 2)
        Else
            $s_IEReturn &= Chr($n_IEChar)
        EndIf
    Next
    $sSearch = $s_IEReturn
    
    $url = "http://www.autoitscript.com/forum/index.php?act=xmlout&do=get-member-names&name=" & $sSearch
    $httpObj = ObjCreate("winhttp.winhttprequest.5.1"); Get the info
    If Not IsObj($httpObj) Then Return SetError(2)
    $httpObj.open("GET", $url)
    $httpObj.send()
    $HTMLResponce = $httpObj.Responsetext
    
    $HTMLResponce = StringTrimLeft($HTMLResponce, 29 + StringLen($sSearch)); Read the info
    $HTMLResponce = StringTrimRight($HTMLResponce, 4)
    $HTMLResponce = StringSplit($HTMLResponce, '"), new Array(', 1)
    $asNames = StringSplit($HTMLResponce[1], '","', 1)
    $asNumbers = StringSplit($HTMLResponce[2], ',', 1)
    If $asNames[0] <> $asNumbers[0] Then Return SetError(-1); Umm... Oops.
    
    Dim $aReturn[$asNames[0] + 1][2]; Assemble an array
    $aReturn[0][0] = $asNames[0]
    $aReturn[0][1] = $asNumbers[0]
    For $i = 1 To $asNames[0]
        $aReturn[$i][0] = $asNames[$i]
        $aReturn[$i][1] = $asNumbers[$i]
    Next
    Return $aReturn
EndFunc
Now whats the best way to auto complete an input field? I would have posted this on the end of the long tutorial post but I tought it would be easier to start a new topic.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Very Nice... gamerman2360

one small change

For $x = 1 To UBound($return) - 1

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

one small change

That was part of the example. To see everything it returned.

[edit]

Oops, thought you ment the start part, lol.

[edit2]

Well, now that I go back and read it. Ubound($return) was used at the start and in the UDF (as $aReturn). Which did you mean?

Edited by gamerman2360

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