Jump to content
Sign in to follow this  
JakeLynagh

I'm stuck...

Recommended Posts

JakeLynagh

Hi.

I have written a script that makes a number of accounts at a social bookmarking website (like Digg) and saves them to accounts.txt

Now I am half way through making another one, that uses accounts.txt to login to the site and submit a link to another website.

But I am stuck, I can only get it to do it for the first account on the list.

My code is below, can anyone tell me how I can get it to repeat for every account on the list (they are each on a new line)

#include <IE.au3>

#Region --- IE-Builder generated code Start ---

#include <File.au3>

    
$accounts = FileOpen("accounts.txt", 0)
            
$line = FileReadLine($accounts)

$len = StringLen($line)
$location = StringInStr($line, "    ", 0, 1) 
$location = $location -1
$username = StringLeft($line, $location)
$location = $len - $location -1
$password = StringRight($line, $location)
$link =  InputBox("", "What link do you want to add?", "http://www.")
$title =  InputBox("", "What is the title of your link?): ", "Title")
$desc =  InputBox("", "A breif description of the story:", "Description")
$tags =  InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.")

$o_IE = _IECreate ()
$site = ("https://www.bookmarkingsite.com")
_IENavigate ($o_IE, $site)
MouseClick("left", 400, 460 )
Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}")

Sleep(5000)

_IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add") 

MouseClick("left", 400, 360 )

Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}")
Edited by JakeLynagh

Share this post


Link to post
Share on other sites
Achilles

#include <IE.au3>

#Region --- IE-Builder generated code Start ---

#include <File.au3>

   
$accounts = FileOpen("accounts.txt", 0)

Dim $infoArray
_FileReadToArray('accounts.txt', $infoArray)



For $i = 1 to UBound($infoArray)

    $line = FileReadLine($accounts, $i)

    $len = StringLen($line)
    $location = StringInStr($line, "    ", 0, 1)
    $location = $location -1
    $username = StringLeft($line, $location)
    $location = $len - $location -1
    $password = StringRight($line, $location)
    $link =  InputBox("", "What link do you want to add?", "http://www.")
    $title =  InputBox("", "What is the title of your link?): ", "Title")
    $desc =  InputBox("", "A breif description of the story:", "Description")
    $tags =  InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.")

    $o_IE = _IECreate ()
    $site = ("https://www.bookmarkingsite.com")
    _IENavigate ($o_IE, $site)
    MouseClick("left", 400, 460 )
    Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}")

    Sleep(5000)

    _IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add")

    MouseClick("left", 400, 360 )

    Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}")
    
Next
I'm not sure if this is exactly what you want but is should lead in the right direction. The For... Next loop is a key feature in repeating a set of steps a certain amount of times... The UBound command simply gets the size of the array..


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
JakeLynagh

Thanks, I will try it later, right now that site it was used for is down.

#include <IE.au3>

#Region --- IE-Builder generated code Start ---

#include <File.au3>

   
$accounts = FileOpen("accounts.txt", 0)

Dim $infoArray
_FileReadToArray('accounts.txt', $infoArray)



For $i = 1 to UBound($infoArray)

    $line = FileReadLine($accounts, $i)

    $len = StringLen($line)
    $location = StringInStr($line, "    ", 0, 1)
    $location = $location -1
    $username = StringLeft($line, $location)
    $location = $len - $location -1
    $password = StringRight($line, $location)
    $link =  InputBox("", "What link do you want to add?", "http://www.")
    $title =  InputBox("", "What is the title of your link?): ", "Title")
    $desc =  InputBox("", "A breif description of the story:", "Description")
    $tags =  InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.")

    $o_IE = _IECreate ()
    $site = ("https://www.bookmarkingsite.com")
    _IENavigate ($o_IE, $site)
    MouseClick("left", 400, 460 )
    Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}")

    Sleep(5000)

    _IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add")

    MouseClick("left", 400, 360 )

    Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}")
    
Next
I'm not sure if this is exactly what you want but is should lead in the right direction. The For... Next loop is a key feature in repeating a set of steps a certain amount of times... The UBound command simply gets the size of the array..

Share this post


Link to post
Share on other sites
JakeLynagh

Okay, that repeats it, thats not what I want done.

I have a list of usernames and passwords created by my other bot like:

User Pass

User Pass

User Pass

User Pass

User Pass

User Pass

What I had got The top one and did what I wanted it to do, yours just repeated that with the top account, I want it to do the top on once, then go to the second account, then the third etc.

This is my code now:

#include <IE.au3>

#Region --- IE-Builder generated code Start ---

#include <File.au3>

  
$accounts = FileOpen("accounts.txt", 0)



    $line = FileReadLine($accounts)

    $len = StringLen($line)
    $location = StringInStr($line, "    ", 0, 1)
    $location = $location -1
    $username = StringLeft($line, $location)
    $location = $len - $location -1
    $password = StringRight($line, $location)
    $link =  InputBox("", "What link do you want to add?", "http://www.")
    $title =  InputBox("", "What is the title of your link?): ", "Title")
    $desc =  InputBox("", "A breif description of the story:", "Description")
    $tags =  InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.")

Dim $infoArray
_FileReadToArray('accounts.txt', $infoArray)



For $i = 1 to UBound($infoArray)

    $o_IE = _IECreate ()
    $site = ("https://www.website.com/Main")
    _IENavigate ($o_IE, $site)
    MouseClick("left", 400, 500 )
    
    
    Send("{tab}"& $username & "{tab}" & $password & "{enter}")

    Sleep(5000)

    _IENavigate ($o_IE, "https://www.website.com/AddLink")

    MouseClick("left", 400, 360 )

    Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}")
    _IENavigate ($o_IE, "https://www.website.com/Logout")
  
Next

Can anyone help?

Share this post


Link to post
Share on other sites
stampy

Get the user and password during the loop

#include <IE.au3>

#Region --- IE-Builder generated code Start ---

#include <File.au3>

 

    $link =  InputBox("", "What link do you want to add?", "http://www.")
    $title =  InputBox("", "What is the title of your link?): ", "Title")
    $desc =  InputBox("", "A breif description of the story:", "Description")
    $tags =  InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.")

Dim $infoArray
_FileReadToArray('accounts.txt', $infoArray)



For $i = 1 to UBound($infoArray)

    $len = StringLen($infoArray[$i])
    $location = StringInStr($infoArray[$i], "    ", 0, 1)
    $location = $location -1
    $username = StringLeft($infoArray[$i], $location)
    $location = $len - $location -1
    $password = StringRight($infoArray[$i], $location)


    $o_IE = _IECreate ()
    $site = ("https://www.website.com/Main")
    _IENavigate ($o_IE, $site)
    MouseClick("left", 400, 500 )
   
   
    Send("{tab}"& $username & "{tab}" & $password & "{enter}")

    Sleep(5000)

    _IENavigate ($o_IE, "https://www.website.com/AddLink")

    MouseClick("left", 400, 360 )

    Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}")
    _IENavigate ($o_IE, "https://www.website.com/Logout")
 
Next

Share this post


Link to post
Share on other sites
glasglow

Just loop through the list(s)

While 1
  $homey = $homey + 1
  $name= FileReadLine($file_in)
  $pass= FileReadLine($file2_in)
  If @error = -1 Then ExitLoop;

(Sorry I needed to edit this) I just saw something.. you are using arrays.. you can if I am not mistake also loop through the array but the difference between yours and mine is I am using FileReadLine and you are using Array....

Edited by glasglow

Share this post


Link to post
Share on other sites
Squirrely1

@JakeLynagh - One could wonder why you would want to automate a social networking site, are you some sort of Maoist social engineer or do you want a computer to decide for you which are the loveliest women posting there? :D


Das Häschen benutzt Radar

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.