Sign in to follow this  
Followers 0
lolp1

Random?

9 posts in this topic

Hello, I'm creating a "spam bot" so to speak, if that is what you would like to call it. (All though, that is not really the point of the program)

I have pretty limted expiernce with Auto-it, so I was wondering how to do the following:

Have it choos a random combination of the following letters:

liouysx

And then, what ever combination it chooses, Send("combination").. Need help;)!

Share this post


Link to post
Share on other sites



Well, here is one way to get the random string:

$text = "liouysx"
$textlen = StringLen($text)
for $i = 1 to $textlen
    $index = Random(1, $textlen, 1) ; pick a random character
    $tmp = StringMid($text, $index, 1)  ; store the character in a temporary variable
    $str1 = StringLeft($text, $index - 1) ; split the string, excluding the character
    $str2 = StringRight($text, $textlen - $index)
    $text = $tmp & $str1 & $str2    ; place the character at the beginning of the string
Next
MsgBox(0, "Random Mix", "Text : " & $text)

BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
Share on other sites

Hello, I'm creating a "spam bot" so to speak, if that is what you would like to call it. (All though, that is not really the point of the program)

I have pretty limted expiernce with Auto-it, so I was wondering how to do the following:

Have it choos a random combination of the following letters:

liouysx

And then, what ever combination it chooses, Send("combination").. Need help;)!

Can it be possible to use the same one twice?

Global $letter[8]

For $int = 1 to 7
$letterNum = Random(1,7,1)

Select
    Case $letternum = 1
        $letter[$int] = "l"
    Case $letternum = 2
        $letter[$int] = "i"
    Case $letternum = 3
        $letter[$int] = "o"
    Case $letternum = 4
        $letter[$int] = "u"
    Case $letternum = 5
        $letter[$int] = "s"
    Case $letternum = 6
        $letter[$int] = "x"
    Case $letternum = 7
        $letter[$int] = "y"
EndSelect

Next

$word = $letter[1]&$letter[2]&$letter[3]&$letter[4]&$letter[5]&$letter[6]&$letter[7]

Msgbox(0, "Random Letters", $word)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm if its anything like how the guy hacked the password on national treasure are you sure theres no repeat letters? lol :P

Edited by Rad

Share this post


Link to post
Share on other sites

Hmm if its anything like how the guy hacked the password on national treasure are you sure theres no repeat letters? lol :P

If he doesn't want it to repeat, it can also be done like this

Global $letter[8],$used=""

For $int = 1 to 7
$letterNum = Random(1,7,1)

Select
    Case $letternum = 1
        If not StringInStr($used, 'l') Then
            $letter[$int] = "l"
            $used = $used&"l"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 2
        If not StringInStr($used, 's') Then
            $letter[$int] = "s"
            $used = $used&"s"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 3
        If not StringInStr($used, 'i') Then
            $letter[$int] = "i"
            $used = $used&"i"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 4
        If not StringInStr($used, 'o') Then
            $letter[$int] = "o"
            $used = $used&"o"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 5
        If not StringInStr($used, 'y') Then
            $letter[$int] = "y"
            $used = $used&"y"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 6
        If not StringInStr($used, 'u') Then
            $letter[$int] = "u"
            $used = $used&"u"
        Else
            $int = $int-1 
        Endif
    Case $letternum = 7
        If not StringInStr($used, 'x') Then
            $letter[$int] = "x"
            $used = $used&"x"
        Else
            $int = $int-1 
        Endif
EndSelect
Next
$Used = ""
$word = $letter[1]&$letter[2]&$letter[3]&$letter[4]&$letter[5]&$letter[6]&$letter[7]

Msgbox(0, "Random Letters", $word)

Share this post


Link to post
Share on other sites

Or much shorter :P

;~~~~~~~~~~~~~~~~~~~~~~~~~;
;~~ liouysx random generator ;~~
;~~~~~~~~~~~~~~~~~~~~~~~~~;
Global $comb, $rand
$liouysx = StringSplit("l,i,o,u,y,s,x",",")
Do 
    $rand = $liouysx[Round(Random(1,7))]
    If StringInStr($comb,$rand) = 0 Then;if the random letter is still not in the combination,it is added to the combination
        $comb = $comb & $rand
    EndIf
Until StringLen($comb) > 6; it makes a string,which contains random liouysx letters(no one is present twice),until there are 7 characters(no more possibilities)
MsgBox(0,"liouysx random generator","Generated liouysx combination: " & $comb)
;~~~~~~~~~~~~~~~~~~~~~~~~~;
;~~ liouysx random generator ;~~
;~~~~~~~~~~~~~~~~~~~~~~~~~;

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Or much shorter :P

;~~~~~~~~~~~~~~~~~~~~~~~~~;
;~~ liouysx random generator ;~~
;~~~~~~~~~~~~~~~~~~~~~~~~~;
Global $comb, $rand
$liouysx = StringSplit("l,i,o,u,y,s,x",",")
Do 
    $rand = $liouysx[Round(Random(1,7))]
    If StringInStr($comb,$rand) = 0 Then;if the random letter is still not in the combination,it is added to the combination
        $comb = $comb & $rand
    EndIf
Until StringLen($comb) > 6; it makes a string,which contains random liouysx letters(no one is present twice),until there are 7 characters(no more possibilities)
MsgBox(0,"liouysx random generator","Generated liouysx combination: " & $comb)
;~~~~~~~~~~~~~~~~~~~~~~~~~;
;~~ liouysx random generator ;~~
;~~~~~~~~~~~~~~~~~~~~~~~~~;
lol well size doesn't matter :nuke::) Edited by Paulie

Share this post


Link to post
Share on other sites

Thanks a bunch:)

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  
Followers 0