Jump to content
UBot Underground

How to split lists when multithreading to login? [Resolved]


Recommended Posts

This is a simple example.

clear list(%list)
add list to list(%list, $list from text("Larry,Moe,Currly", ","), "Delete", "Global")
loop($list total(%list)) {
    thread {
        in new browser {
            navigate("https://www.google.com/", "Wait")
            wait for browser event("Page Loaded", "")
            type text(<name="q">, $next list item(%list), "Standard")
            pause script
        }
    }
}

Buddy

Link to post
Share on other sites

This is a simple example.

clear list(%list)
add list to list(%list, $list from text("Larry,Moe,Currly", ","), "Delete", "Global")
loop($list total(%list)) {
    thread {
        in new browser {
            navigate("https://www.google.com/", "Wait")
            wait for browser event("Page Loaded", "")
            type text(<name="q">, $next list item(%list), "Standard")
            pause script
        }
    }
}

Buddy

 

This is a simple example.

clear list(%list)
add list to list(%list, $list from text("Larry,Moe,Currly", ","), "Delete", "Global")
loop($list total(%list)) {
    thread {
        in new browser {
            navigate("https://www.google.com/", "Wait")
            wait for browser event("Page Loaded", "")
            type text(<name="q">, $next list item(%list), "Standard")
            pause script
        }
    }
}

Buddy

I'm using the define method, my code, my block text is "User:pass"

 

loop($list total(%load_acc)) {

        clear list(%use_acc)

        add list to list(%use_acc$list from text($next list item(%load_acc), ":"), "Delete""Global")

        type text($element offset(<name="user[login]">, 0), $list item(%use_acc, 0), "Standard")

        wait for element($element offset(<password field>, 0), """Appear")

        type text(<password field>$list item(%use_acc, 1), "Standard")

Link to post
Share on other sites

put your "list items" in a set command each instead and make sure they are set to local

 

and use variables in the type text commands

Tried this, not working.

When the bot loads, it loads one account only, %use_acc (username:pass)

All 3 threads will use this one account, then when each thread has finished, the bot will then load another account, but all 3 threads will use that one account

Link to post
Share on other sites

I had a similar problem.

 

Note that wait(5) did not work and I didn't try any other values. I would

probably need a longer wait on a slower computer. Note also that the

wait was not part of the thread code - it was after the thread.

 

All threads were exactly the same until I put a wait(10) after starting each thread as follows:

 

clear list(%list)
add list to list(%list, $list from text("Larry,Moe,Currly", ","), "Delete", "Global")
loop($list total(%list)) {
    thread {
        in new browser {
            navigate("https://www.google.com/", "Wait")
            wait for browser event("Page Loaded", "")
            type text(<name="q">, $next list item(%list), "Standard")
            pause script
        }
    }

    wait(10)
}

 

There are probably solutions that are faster and much more elegant

but this one was OK for what I was doing.

Link to post
Share on other sites

I think the OP was having issues with passing variables into custom defined commands.

 

The way its done in the following example is to set the global variables before the thread is opened and then pass those global variables to the custom command which will use them as local variables.

In the example, I added a wait for 100 seconds just so you can switch between the open browsers and see that it is using unique account info for each thread.

 

Hope this helps

clear list(%accounts)
add list to list(%accounts, $list from text("user1:pass1,user2:pass2,user3:pass3,user4:pass4,user5:pass5", ","), "Delete", "Global")
loop($list total(%accounts)) {
    set(#global_account, $next list item(%accounts), "Global")
    set(#global_username, $find regular expression(#global_account, ".+(?=\\:)"), "Global")
    set(#global_password, $find regular expression(#global_account, "(?<=\\.+"), "Global")
    thread {
        in new browser {
            login(#global_username, #global_password)
        }
    }
    wait(.5)
}
define login(#local_username, #local_password) {
    set(#local_username, #local_username, "Local")
    set(#local_password, #local_password, "Local")
    load html("username: {#local_username} <br><br>
password: {#local_password}")
    wait(100)
}

threading_with_list_example.ubot

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...