Jump to content

Inserting random lines of pre selected text


xvdw
 Share

Recommended Posts

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. 

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

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

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

Link to comment
Share on other sites

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

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

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...