Jump to content

Need help coding a simple script


Recommended Posts

Hey guys and girls

I'm new here but I've been tinkering with Autoit for almost half a year now. I've got the new beta version so everything should be ok.

I'm having a few problems with coding a simple script and I though maybe you lot could help me out. Basically, it is a bot which you load Bebo accounts into and it checks if they are verified. I know how to do the checking, I'm just not sure on how I go about loading them and getting the backbone there.

The .txt file that will be loaded is laid out like this:

username - password

username - password

username - password

Here is my code. I hope you will be able to help me out as much as you can.

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>

GUICreate("Bebo Verifier - mattygibbard", 300, 300)
;GUISetIcon ("bebo.ico")

$loadaccounts = GUICtrlCreateButton ("Load Accounts",  10, 30, 100)
$NumberOfAccounts = guictrlcreateinput ( "No Accounts Loaded   :-(", 120,30,150)
$Verified = guictrlcreateinput ( "verified", 10,100,70)
$Checked = guictrlcreateinput ( "checked", 10,130,70)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select

        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
                    
        Case $msg = $loadaccounts
            $Accounts = FileOpenDialog("Load Accounts", @DesktopDir & "", "Accounts (*.txt)", 1 )
            
EndSelect
Wend

I would like to get the label that says, 'No accounts loaded' to count how many lines are in the notepad file loaded and display a number in that box. Also I would like to know how I would go about Autoit remembering them usernames and passwords then trying one, then trying another ETC

Any help is greatly appreciated.

Thanks

Matt Gibbard

Link to comment
Share on other sites

Look for _FileCountLines() in the help file. As far as the remeber usernames, do you mean within the session of the process, or remeber next time the process runs?

Link to comment
Share on other sites

Look for _FileCountLines() in the help file. As far as the remeber usernames, do you mean within the session of the process, or remeber next time the process runs?

Thanks! I now have it to count the ammount of lines (accounts) in the loaded file and put the number in the input box. :D

Basically, what I want to achieve is:

1. Load accounts *Done*

2. Click 'Start'

3. It goes to www.bebo.com/SignIn.jsp

4. It sign's in with the first username and password from the file

5. It checks the page for a certain word

6. If the word is not there, then it adds 1 to the verified box and add's the username to a new list (Verified List)

7. Repeats this process with second account all he way to the end

8. Then you can save the accounts into a new txt file that are verified (Without the word)

I know this is a big project but I'm wiling to spend time on this and make it as good as possible. Also any help will be credited.

Here is my code again with the added functions. If you think you can add anything or start helping me with the above then please leave a comment or an updated code:

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>

GUICreate("Bebo Verifier - mattygibbard", 300, 300)
GUISetIcon ("bebo.ico")

$loadaccounts = GUICtrlCreateButton ("Load Accounts",  10, 30, 100)
$NumberOfAccounts = guictrlcreateinput ( "No Accounts Loaded   :-(", 120,30,150)
$Verified = guictrlcreateinput ( "verified", 10,100,70)
$Checked = guictrlcreateinput ( "checked", 10,130,70)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $loadaccounts
            $Accounts = FileOpenDialog("Load Accounts", @DesktopDir & "", "Accounts (*.txt)", 1 )
            $CountLines = _FileCountLines($Accounts)
            GUICtrlSetData($NumberOfAccounts, $CountLines & " accounts loaded")
    
    EndSelect
Wend

Any help would be appreciated

Thanks

Matt Gibbard

Link to comment
Share on other sites

Thanks for your help. I've been messing about with the script and come up with an even better one.

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#include <string.au3>
#include <IE.au3>
#include <Misc.au3>
#include <INet.au3>

GUICreate("Bebo Verified Checker v0.1", 300, 320)

;GUISetIcon ("bebo.ico")

$filemenu = GUICtrlCreateMenu ("&File")
$exitmenu = GUICtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GUICtrlCreateMenu ("Help")
$aboutmenu = GUICtrlCreateMenuitem ("About",$helpmenu)
$hmenu = GUICtrlCreateMenuitem ("Help",$helpmenu)

guictrlcreatelabel ( "Bebo Verified Checker v0.1   -   made by mattygibbard", 20, 05)
guictrlcreatelabel ( "Info", 50, 115)

$loadaccounts = GUICtrlCreateButton ("Load Accounts",  10, 30, 100)
$savelist = GUICtrlCreateButton ("Save",  180, 270, 50)
$clearlist = GUICtrlCreateButton ("Clear",  240, 270, 50)
$NumberOfAccounts = guictrlcreateinput ( "No Accounts Loaded   :-(", 120,30,170)
$Verified = guictrlcreateinput ( "None Verified", 20,130,80)
$Checked = guictrlcreateinput ( "None Checked", 20,160,80)
$start = GUICtrlCreateButton ("Start",  10, 60, 100)
$AccoutsVerified = GUICtrlCreateInput ( "",120,60,170,205)
$Countlines = 0
$line = 1

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $loadaccounts
            $Accounts = FileOpenDialog("Load Accounts", @DesktopDir & "", "Accounts (*.txt)", 1 )
            $CountLines = _FileCountLines($Accounts)
            GUICtrlSetData($NumberOfAccounts, $CountLines & " accounts loaded")
            
        Case $msg = $start
            If $Countlines = 0 Then
                MsgBox(0, "Error", "No Accounts loaded")
            Else
                $info = FileReadLine ($Accounts , $line )
                $oIE = _IECreate()
                _IENavigate($oIE, "http://www.bebo.com/SignIn.jsp")
                
            EndIf
            
        Case $msg = $exitmenu
            exit
            
        Case $msg = $aboutmenu
            MsgBox ( 0, "About Bebo Verified Checker", "Made by mattygibbard" & @lf & @lf & "www.bebo.com/matty3861")
            
        Case $msg = $hmenu
            MsgBox ( 0, "Help", "Helpfile")
            
        Case $msg = $savelist
            MsgBox ( 0, "Save", "FileWouldBeSaved")
            
        Case $msg = $clearlist
            MsgBox ( 0, "Clear", "FileWouldBeCleared")
    
    EndSelect
Wend

Compile that and see what you guys think.

What I now need to know is how to get it to read the notepad:

username - password
username - password

So the first username and password gets read and tried on http://www.bebo.com/SignIn.jsp

Thanks again guys

Edited by mattygibbard
Link to comment
Share on other sites

What I now need to know is how to get it to read the notepad:

username - password
username - password

So the first username and password gets read and tried on http://www.bebo.com/SignIn.jsp

Thanks again guys

First you should remove the white spaces around the hyphen in that text file so it looks like this

username-password

Use

_FileReadToArray() and then StringSplit() Each Element

Global $myArray, $data
_FileReadToArray("MyFile.txt", $myArray)
For $I = 1 to Ubound($myArray)-1
$Data = StringSplit($myArray[$I], "-")
$user = $Data[1]
$Pass = $Data[2]
Do what you want in here.
Next

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

For some reason, I can't seem to add that into my code. How would I go about adding that into this:

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#include <string.au3>
#include <IE.au3>
#include <Misc.au3>
#include <INet.au3>

GUICreate("Bebo Verified Checker v0.1", 300, 320)

GUISetIcon ("bebo.ico")

$filemenu = GUICtrlCreateMenu ("&File")
$exitmenu = GUICtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GUICtrlCreateMenu ("Help")
$aboutmenu = GUICtrlCreateMenuitem ("About",$helpmenu)
$hmenu = GUICtrlCreateMenuitem ("Help",$helpmenu)

guictrlcreatelabel ( "Bebo Verified Checker v0.1   -   made by mattygibbard", 20, 05)
guictrlcreatelabel ( "Info", 50, 115)

$loadaccounts = GUICtrlCreateButton ("Load Accounts",  10, 30, 100)
$savelist = GUICtrlCreateButton ("Save",  180, 270, 50)
$clearlist = GUICtrlCreateButton ("Clear",  240, 270, 50)
$NumberOfAccounts = guictrlcreateinput ( "No Accounts Loaded   :-(", 120,30,170)
$Verified = guictrlcreateinput ( "None Verified", 20,130,80)
$Checked = guictrlcreateinput ( "None Checked", 20,160,80)
$start = GUICtrlCreateButton ("Start",  10, 60, 100)
$AccoutsVerified = GUICtrlCreateInput ( "",120,60,170,205)
$Countlines = 0
$line = 1

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $loadaccounts
            $Accounts = FileOpenDialog("Load Accounts", @DesktopDir & "", "Accounts (*.txt)", 1 )
            $CountLines = _FileCountLines($Accounts)
            GUICtrlSetData($NumberOfAccounts, $CountLines & " accounts loaded")
            
        Case $msg = $start
            If $Countlines = 0 Then
                MsgBox(0, "Error", "No Accounts loaded")
            Else
                $info = FileReadLine ($Accounts , $line )
                $oIE = _IECreate()
                _IENavigate($oIE, "http://www.bebo.com/SignIn.jsp")
                
                
            EndIf
            
        Case $msg = $exitmenu
            exit
            
        Case $msg = $aboutmenu
            MsgBox ( 0, "About Bebo Verified Checker", "Made by mattygibbard" & @lf & @lf & "www.bebo.com/matty3861")
            
        Case $msg = $hmenu
            MsgBox ( 0, "Help", "Helpfile")
            
        Case $msg = $savelist
            MsgBox ( 0, "Save", "FileWouldBeSaved")
            
        Case $msg = $clearlist
            MsgBox ( 0, "Clear", "FileWouldBeCleared")
    
    EndSelect
Wend

Cheers, Thanks

Matt Gibbard

Link to comment
Share on other sites

WOW! You are amazing! Everyone who helps out on this post is getting credit on the app.

Ok, here is my new script, with both of the above combined. I'm going to try and make it login within the next few hours.

Here is my checklist:

1. Needs the 'Clear' button to work. I've disabled it so it only shows when accounts are loaded into the tool, but I can't get them to clear. I want the list of accounts cleared and also the number of accounts loaded.

2. Needs to log into bebo with the first account, then logout. Logout url is "http://www.bebo.com/SignOut.jsp". Then sign in with the next account and repeat to the end which then gives a message saying 'Complete'.

3. Save button needs to be fixed. I've got it to save but it only saves one account. If I load up 10 accounts and click save, then it only saves the last one. I want it to save the whole box as:

username - password
username - password

Any help with the above would be appreciated. Number 2 is obviously the most important at this stage but any other help is a step forwards. Ive added the people that have helped into credits.

Thanks

New code is:

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#include <string.au3>
#include <IE.au3>
#include <Misc.au3>
#include <INet.au3>

GUICreate("Bebo Verified Checker v0.1", 300, 320)

GUISetIcon ("bebo.ico")

$filemenu = GUICtrlCreateMenu ("&File")
$exitmenu = GUICtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GUICtrlCreateMenu ("Help")
$creditsmenu = GUICtrlCreateMenuitem ("Credits",$helpmenu)
$aboutmenu = GUICtrlCreateMenuitem ("About",$helpmenu)
$hmenu = GUICtrlCreateMenuitem ("Help",$helpmenu)

guictrlcreatelabel ( "Bebo Verified Checker v0.1   -   made by mattygibbard", 20, 05)
guictrlcreatelabel ( "Info", 50, 115)

$loadaccounts = GUICtrlCreateButton ("Load Accounts",  10, 30, 100)
$savelist = GUICtrlCreateButton ("Save",  180, 270, 50)
$clearlist = GUICtrlCreateButton ("Clear",  240, 270, 50)
$NumberOfAccounts = guictrlcreateinput ( "No Accounts Loaded", 120,30,170)
$Verified = guictrlcreateinput ( "None Verified", 20,130,80)
$Checked = guictrlcreateinput ( "None Checked", 20,160,80)
$start = GUICtrlCreateButton ("Start",  10, 60, 100)
$loadedAccounts = GuiCtrlCreateListView("No|Username|Password", 120, 60, 170, 205)

$finalcheck = 0
$finalverify = 0

$Countlines = 0
$line = 1

GUICtrlSetState ( $clearlist, $GUI_DISABLE )

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
       
        Case $msg = $GUI_EVENT_CLOSE
            Exit 0

        Case $msg = $loadaccounts
            $Accounts = FileOpenDialog("Load Accounts", @DesktopDir & "", "Accounts (*.txt)", 1 )
            $CountLines = _FileCountLines($Accounts)
            GUICtrlSetData($NumberOfAccounts, $CountLines & " accounts loaded")
            GUICtrlSetState ( $clearlist, $GUI_ENABLE )
            GUICtrlSetState ( $loadaccounts, $GUI_DISABLE )
           
            Global $myArray, $Data
            _FileReadToArray($Accounts, $myArray)
            For $I = 1 to Ubound($myArray)-1
            $Data = StringSplit($myArray[$I], "-")
            $user = $Data[1]
            $Pass = $Data[2]
          ;_ArrayDisplay($myArray)
            GuiCtrlCreateListViewItem($I & "|" & $user & "|" & $Pass, $loadedAccounts)
            Next
           
        Case $msg = $start
            If $Countlines = 0 Then
                MsgBox(0, "Error", "No Accounts loaded")
            Else
                GUICtrlSetData($Checked, $finalcheck & " Checked")
                GUICtrlSetData($Verified,$finalverify & " Verified")
                Global $myArray, $Data
            _FileReadToArray($Accounts, $myArray)
            For $I = 1 to Ubound($myArray)-1
            $Data = StringSplit($myArray[$I], "-")
            $user = $Data[1]
            $Pass = $Data[2]
          ;_ArrayDisplay($myArray)
            MsgBox(0,"TestBox","user: " & $user & " and pass: " & $Pass)
            Next
           
            $info = FileReadLine ($Accounts , $line )
            $oIE = _IECreate()
            _IENavigate($oIE, "http://www.bebo.com/SignIn.jsp")
            EndIf
           
        Case $msg = $exitmenu
            exit
            
        Case $msg = $creditsmenu
            MsgBox ( 0, "Credits", "MattyGibbard" & @lf & "Spudw2k" & @lf & "newbiescripter" & @lf & "GEOsoft" & @lf & @lf & "Thanks for all your help guys")
           
        Case $msg = $aboutmenu
            MsgBox ( 0, "About Bebo Verified Checker", "Made by mattygibbard" & @lf & @lf & "www.bebo.com/matty3861")
           
        Case $msg = $hmenu
            MsgBox ( 0, "Help", "Helpfile")
           
       Case $msg = $savelist
           If $Countlines = 0 Then
                MsgBox(0, "Error", "No Accounts loaded")
            Else
            $savelocation = FileSaveDialog ( "Save Verified Accounts", @DesktopDir, "Text File (*.txt)", 2, ".txt")
            FileWriteLine ($savelocation, $user);& "-" & $pass)
            
            Endif
           
        Case $msg = $clearlist
            MsgBox ( 0, "Clear", "FileWouldBeCleared")
            GUICtrlSetState ( $loadaccounts, $GUI_Enable )
            GUICtrlSetState ( $clearlist, $GUI_Disable )
   
   
    EndSelect
Wend

Cheers

Matt Gibbard

Edited by mattygibbard
Link to comment
Share on other sites

I'll expain what I wanted. I wanted the accounts to be loaded, displayed in that box. That is done. Then I wanted the bot to run. The run would login using the 1st account and check the page for a certain word. If the account had that word, it would stay in that box, if not, it would be removed. It will repeat this process up till the last account. Then at the end, only the good accounts will be in the box which can then be saved out.

If thats not possible, is there any other way I can check on accounts for a word and see what accounts have it and dont?

Link to comment
Share on other sites

A couple of things here;

Since I can't tell if you have removed those spaces that I mentioned earlier then change

$Data = StringSplit($myArray[$I], "-")

$user = $Data[1]

$Pass = $Data[2]

To

$Data = StringSplit($myArray[$I], "-")

$user = StringStripWS($Data[1], 3)

$Pass = StringStripWS($Data[2], 3)

Now when you get to the page I think you want to discard any where the word exists. Is that correct?

If it is then what is your code to check if the word exists or not?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...