Jump to content



Photo

Hi, I'm New, I'm Excited, And I'm Having A Lot Of Trouble.

change proxy loop loop while if if else

  • Please log in to reply
2 replies to this topic

#1 Sebastian Rooks

Sebastian Rooks

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
  • OS:Windows 10
  • Total Memory:4Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 17 January 2016 - 10:48 AM

Hi, everyone.

 

I'm new to this. I've been working with Ubot for 4 (solid) days now. I'm really excited about everything it is capable of but I'm having a pretty difficult time getting started. I've watched many of the tutorials, and done a ton of reading. I'm having a hard time getting some things to flow right, and I could really use a little guidance. I have no previous coding experience, and could really use a push in the right direction. I hope I'm in the right place.

 

For my first bot, i'd like take a .csv of twitter account info, Username, Password, Proxy, import that to a table, Then cycle through those accounts with their respective proxies, making a note of which accounts are LOCKED in a 4th column of the table.

 

That table then saves to the original file, so that next time the bot loads, it checks to see if 4th column of the table is marked as being locked. If it is, then it skips that file and moves to the next one without trying to log into it.

 

If it finds an account that's in working order, it's to cycle through defines that are to be set by ui checkboxes. These will include the option to Change passwords, profile pictures, header pictures, bios, names, and usernames.

 

Some of the problems that I'm having at this point include:

 

Difficulty with UI EDITOR: I used the UI editor, made what I wanted, saved it, assigned the variables, saved my work, closed and reopened, then the UI that I built in the editor was gone. This happened several times. Why? What have I done to cause the UI editor to forsake me?

 

Difficulty with CHANGE PROXY - 

I thought my approach seemed straight forward, but it keeps getting hung up on change proxy when I try to run.

 

Change proxy - $table cell - &mytable - #rowincrement - column 2

For some reason the variable #proxy (which I use to display the proxy with UI STAT) won't update unless I paste SET command underneath every INCREMENT command. I don't understand the cause of this because the other variables are updated without doing that.

 

I'm also having trouble making the best use of the available commands to accomplish my tasks. If you'll look at my code you'll see that I'm trying to accomplish my objectives through a series of LOOP, LOOP WHILE, IF. You'll also probably see that I don't seem to know my ass from a hole in the ground, and could use a kick in the right direction.

 

My hope is that someone can take a look at what I've done, compare it to what I'm trying to do (outlined above), and point me in the direction of the proper commands, structure, or, proper use of the commands I'm already using, to get me moving forward again.

 

I have been stuck now without any progress for a sad and frustrating day and a half. Please forgive me for the length of this post,

and if I haven't followed the right format. I'm new, this is my first post, and I hope to stay here, learn, prosper, and become an active member of the Ubot community.

 

I know that this is probably a jumbled mess. Remember what it was like to try and learn something new? 

 

Thanks for any help or guidance that you can offer me related to my code.

 

clear table(&npip)
ui open file("Account info file",#openfile0)
ui text box("Minimum time delay",#mintime)
ui text box("Maximum time delay",#maxtime)
ui check box("Change Passwords",#changepassword)
ui stat monitor("Proxy ",#proxy)
create table from file(#openfile0,&npip)
define LogOutofTwitter {
    click(<id="user-dropdown-toggle">,"Left Click","No")
    click(<innertext="Log out">,"Left Click","No")
}
set(#rowincrement,0,"Global")
set(#totalaccounts,$table total rows(&npip),"Global")
set(#locked,0,"Global")
set(#proxy,$table cell(&npip,#rowincrement,2),"Global")
pause script
loop($table total rows(&npip)) {
    loop while($contains($table cell(&npip,#rowincrement,3),"locked")) {
        increment(#locked)
        increment(#rowincrement)
        set(#proxy,$table cell(&npip,#rowincrement,2),"Global")
    }
    loop while($not($exists($element offset(<class="Icon Icon--tweet Icon--large">,0)))) {
        clear cookies
        set(#proxy,$table cell(&npip,#rowincrement,2),"Global")
        change proxy(#proxy)
        clear cookies
        navigate("www.twitter.com/login","Wait")
        wait for element($element offset(<login button>,1),"","Appear")
        type text($element offset(<email field>,1),$table cell(&npip,#rowincrement,0),"Standard")
        type text($element offset(<password field>,1),$table cell(&npip,#rowincrement,1),"Standard")
        wait($rand(#mintime,#maxtime))
        click($element offset(<login button>,1),"Left Click","No")
        wait($rand(#mintime,#maxtime))
        if($comparison(#changpass,"= Equals",$true)) {
            then {
                Changepassword("")
                LogOutofTwitter()
            }
            else {
                LogOutofTwitter()
            }
        }
        LogOutofTwitter()
    }
    wait($rand(5,20))
}

Attached Files



#2 HelloInsomnia

HelloInsomnia

    Advanced Member

  • Moderators
  • 3067 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 17 January 2016 - 11:30 AM

Overall it's pretty good for only using Ubot for 4 days. I think you're on the right track :) I don't use Twitter at all so I can't help you too much other than try to give a bit of advice. Up until your first loop statement everything looks fine. In the second loop while statement I don't know what that is looping for but you are not incrementing the #rowincrement any more and so it could possibly be logging into the same account over and over again.

 

I'm guessing you want to be adding the non locked Twitter accounts into a second table first and then looping through those and doing the second part of the program? In this case you would add the non locked accounts to a second table and then loop for the table total rows of that table logging into each account and doing what you need to do.

 

Change proxy - $table cell - &mytable - #rowincrement - column 2

For some reason the variable #proxy (which I use to display the proxy with UI STAT) won't update unless I paste SET command underneath every INCREMENT command. I don't understand the cause of this because the other variables are updated without doing that.

 

 

When you increment the variable #rowincrement that will change that number to be +1. After that you have to set the #proxy variable to be the new table cell for the proxy or it will not update automatically. Even though #rowincrement has changed it will not automatically update the code that happens before it in the program if that makes sense. Once it updates you have to then set the new proxy as the #rowincrement has changed. This is a good thing, if it updated all commands that variable was in then no program would work correctly.



#3 Sebastian Rooks

Sebastian Rooks

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
  • OS:Windows 10
  • Total Memory:4Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 17 January 2016 - 03:34 PM

I really appreciate the encouragement and the help. I'll go over it now and see if I can't clean things up with your suggestions.

Also thanks for clearing up the non auto updating variable. I feel more comfortable knowing that it's supposed to be that way.

 

 

I tried adding the missing INCREMENT to the second loop while. It fixed something, and then it broke something else. lol.

Now that part works, but when it moves to the next section, it skips one on the list.

 

I think I'm going to try to rewrite what I'm trying to do using more DEFINES, IFS, and ELSE IFS, and less LOOP WHILES. I don't know if that really makes sense, but maybe I'll at least learn something from the effort.


Edited by Sebastian Rooks, 17 January 2016 - 04:52 PM.






Also tagged with one or more of these keywords: change proxy, loop, loop while, if, if else

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users