xvdw

Inserting random lines of pre selected text

6 posts in this topic

Hi guys,

I need some help being able to enter a random string of text, my code is as follows for where I need to action this. 

_IEAction ($oElement2, "focus")
Send("Blah blah blah")
EndIf

Where it says send("blah blah blah") I need it to choose from one of maybe 30 different random strings of text to send. 

I have tried using the help but can only work out how to send random numbers. I have a feeling it'll be similar but I cant nail the formatting.

Any help will be great.

Thank you. 

Share this post


Link to post
Share on other sites



Hi guys,

I need some help being able to enter a random string of text, my code is as follows for where I need to action this. 

_IEAction ($oElement2, "focus")
Send("Blah blah blah")
EndIf

Where it says send("blah blah blah") I need it to choose from one of maybe 30 different random strings of text to send. 

I have tried using the help but can only work out how to send random numbers. I have a feeling it'll be similar but I cant nail the formatting.

Any help will be great.

Thank you. 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hmmm...I don't see how this could end well.  Can you surprise us with a reason for this "spam bot"?

kylomas 

edit: Please see the forum rules in my sig

Edited by kylomas
additional info

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

@xvdw, please refrain from double posting in the future. I, too, would like to know a little more about what you're trying to do. It should be pretty easy to hold your strings in an array, and use random to grab the index. If you would like more, please provide some more information on what you're trying to accomplish.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hmmm...I don't see how this could end well.  Can you surprise us with a reason for this "spam bot"?

kylomas 

edit: Please see the forum rules in my sig

Hi guys,

It's not for spamming. 

I'm filling in a company internal webform and we need to simulate A LOT of record entries. Which is fine and I have done, but I want the record entries for the 'comment box' to vary, so when we use the entries as an example its not the same comment looped thousands of times. 

 

Apologies for posting twice, I didn't even realize I did, 

Share this post


Link to post
Share on other sites

xvdw,

Thank you for the reasonable explanation.  One possible way...

#include <array.au3>

; generate array of random text

local $aRandomText[25]

for $i = 0 to ubound($aRandomText) - 1
    for $j = 0 to random(5,15,1)
        $aRandomText[$i] &= chr(random(65,90,1))
    Next
next

_arraydisplay($aRandomText)

_IEAction ($oElement2, "focus")
Send($aRandomText[random(0,24,1)])

Of course, you could construct a file or array of sensible text and use the same technique.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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