Sign in to follow this  
Followers 0
MattyGibbard

Adding an 1 to a number then looping (Simple)

7 posts in this topic

Hey people

I've now got my code almost ready.

Here is what I want to happen:

1. Type in a BeboID into the box (Done)

2. It goes to that page and reads the username if it can and the Id exists (Done)

3. If it does exist, then it saves the username to a notepad (Not Done)

4. It then add's 1 onto the number so 2000 would then be 2001 (Not Done)

5. Go's back to that page with the new ID (Not Done)

6. Repeats until stopped. (Not Done)

All the 'Not Done's need to be coded. I've got a basic idea what I need to do, but I dont know how I would go about starting it. The most important step is after it has done the initial check, it then loops back to the start but with 1 added onto the ID. Simple?

Code:

#include <GUIConstants.au3>
#include <IE.au3>
#include <array.au3>
#include <String.au3>
#include <file.au3>

GUICreate("Leecher", 160, 70)


$leech = GUICtrlCreateButton ("Leech",  10, 40, 61)
$exit = GUICtrlCreateButton ( "Exit",  90, 40, 61)
$id = guictrlcreateinput ( "Enter ID Here", 10,10,140)



;--------------------------------------
GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
;--------------------------------------
        
        
    ;Red X
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    ;Red X Stop
        
;--------------------------------------
            
            
        Case $msg = $leech
            $idcheck = GUIctrlread ($id)

            If $idcheck = "Enter ID Here" Then
                MSgbox (0, "Error", "You didnt enter an ID")
            Else
            ;Do
                $saveloc = FileSaveDialog ( "Save", @DesktopDir, "(*.txt)", 2 , "LeechedAccounts.txt")
                $saving = FileOpen($saveloc, 1)
            $oIE = _IECreate()
_IENavigate($oIE, "http://www.bebo.com/Profile.jsp?MemberId=" & $idcheck)
        $sText = _IEBodyReadText($oIE)
        If StringInStr($sText, "<") Then
            $aArray = _StringBetween($sText, "<", ">")
            FileWriteLine($saving, $aArray[0])
            MsgBox(0, "Found!!!", $aArray[0])
            Winclose ("Windows Internet Explorer")
            
            

Else
    
WinKill ("Please")
Msgbox (0, "Check", "Not Found")
EndIf


;Until

;exit
            
            
            
            
            Endif

    
            
            
        Case $msg = $exit
            exit
    EndSelect
Wend

If you could help me then you will get credited in the app.

Thanks for your help

Matt Gibbard

Share this post


Link to post
Share on other sites



you will be using something like $IDCheck = $IDCheck + 1

and then continuing the loop.

Share this post


Link to post
Share on other sites

For Example...

Global $i=0; set the first number...0
While 1
$i=$i+1
MsgBox(0, "", $i)
WEnd

That will execute the code forever, while counting up.

Share this post


Link to post
Share on other sites

Or he could use a For loop and rid the code of the counter variable you'd need using Do or While loops.

For $i = 2000 To 10000 ; increase 10000 if you need it to loop more
    MsgBox(0, "Number is now at:", $i)
Next

Share this post


Link to post
Share on other sites

Thanks for your help guys, I see how it is meant to work by adding 1 to itself with what Swift said and then looping but I can't get it to work in this code for the life of me.

Can anyone add it to the code for me?

Thanks

Matt Gibbard

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I assume you could do something like this? ( I also changed some stuff in your code.. ):

#include <GUIConstants.au3>
#include <IE.au3>
#include <array.au3>
#include <String.au3>
#include <file.au3>

GUICreate("Leecher", 160, 70)

$save = FileOpen(FileSaveDialog("Save", @DesktopDir, "(*.txt)", 2, "LeechedAccounts.txt"), 1)

$leech = GUICtrlCreateButton("Leech", 10, 40, 61)
$exit = GUICtrlCreateButton("Exit", 90, 40, 61)
$id = GUICtrlCreateInput("Enter ID Here", 10, 10, 140)

GUISetState()

_IESetDisplayImages(False, True) ; Disable ie from showing images and animations, makes loading pages faster.

$oIE = _IECreate("about:blank", 0, 0, 0)

While 1
    
    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $leech
            $idcheck = GUICtrlRead($id)

            If $idcheck = "Enter ID Here" Then
                MsgBox(0, "Error", "You didnt enter an ID")
                ContinueLoop
            Else
                _IEAction($oIE, "visible")
                For $idcheck = $idcheck To 1000
                    _IENavigate($oIE, "http://www.bebo.com/Profile.jsp?MemberId=" & $idcheck)
                    $sText = _IEBodyReadText($oIE)
                    If StringInStr($sText, "<") Then
                        $aArray = _StringBetween($sText, "<", ">")
                        FileWriteLine($save, $aArray[0] & " id: " & $idcheck)
                        ConsoleWrite("Found user: " & $aArray[0] & " with id: " & $idcheck & @LF)
                    Else
                        ConsoleWrite("No user found with id: " & $idcheck & @LF)
                    EndIf
                Next
                _IEAction($oIE, "invisible")
            EndIf
            
        Case $exit
            ExitLoop
    EndSwitch
WEnd

FileClose($save)
_IEAction($oIE, "quit")
_IESetDisplayImages(True, True) ; Re-enable displaying images and animations

Func _IESetDisplayImages($ivState = True, $ivExtendToAnimations = False)
    
    Local $svValue = "yes"
    
    If Not $ivState Then $svValue = "no"
    
    RegWrite("HKCU\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", $svValue)
    
    If $ivExtendToAnimations Then
        RegWrite("HKCU\Software\Microsoft\Internet Explorer\Main", "Play_Animations", "REG_SZ", $svValue)
    EndIf
    
EndFunc

But I wonder what purpose this is for? Nothing ill content I hope?

Edited by FreeFry

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