MattyGibbard Posted April 16, 2008 Share Posted April 16, 2008 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: expandcollapse popup#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 Link to comment Share on other sites More sharing options...
junkew Posted April 16, 2008 Share Posted April 16, 2008 try reading the manual for the while statement FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Tomb Posted April 16, 2008 Share Posted April 16, 2008 you will be using something like $IDCheck = $IDCheck + 1 and then continuing the loop. Link to comment Share on other sites More sharing options...
Swift Posted April 16, 2008 Share Posted April 16, 2008 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. Link to comment Share on other sites More sharing options...
FreeFry Posted April 16, 2008 Share Posted April 16, 2008 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 Link to comment Share on other sites More sharing options...
MattyGibbard Posted April 16, 2008 Author Share Posted April 16, 2008 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 Link to comment Share on other sites More sharing options...
FreeFry Posted April 17, 2008 Share Posted April 17, 2008 (edited) I assume you could do something like this? ( I also changed some stuff in your code.. ): expandcollapse popup#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 April 17, 2008 by FreeFry 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