Jump to content

How Do I Randomize What It Types Using Send("")?


Arez
 Share

Recommended Posts

  • Moderators

Checked and couldn't really find anything.

How would I make it send something random, and specify how many chars it uses?

Thanks

Wow... 1. Send what random? 2. Try to give an example if your not going to post any code, and your asking a specific question like this.

Here, this should give you an idea at least (of what I think you mean)

Send(SendRandomText(5))

Func SendRandomText($i_NumChars)
    Local $GatherInfo = ''
    For $x = 1 To $i_NumChars
        $GatherInfo = $GatherInfo & Chr(Random(65, 90))
    Next
    Return $GatherInfo
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

how about

Send(SendRandomText(5, 2))

Func SendRandomText($i_NumChars, $i_chars = 0)
    Local $GatherInfo = ''
select
case $i_chars = 0
    For $x = 1 To $i_NumChars
        $GatherInfo = $GatherInfo & Chr(Random(65, 90))
    Next
case $i_chars = 1
For $x = 1 To $i_NumChars
        $GatherInfo = $GatherInfo & Chr(Random(97, 122))
    Next
case $i_chars = 2
For $x = 1 To $i_NumChars
$rdm = random (0, 1, 1)
if $rdm = 0 then $GatherInfo = $GatherInfo & Chr(Random(65, 90))
if $rdm = 1 then $GatherInfo = $GatherInfo & Chr(Random(97, 122))
    Next
endselect
    Return $GatherInfo
EndFunc

sorry smoke to mess up your script but i felt like i had to use uppercase & lowercase letters :)

Edited by Nuffilein805
Link to comment
Share on other sites

  • Moderators

sorry smoke to mess up your script but i felt like i had to use uppercase & lowercase letters :)

No worries :mellow: , but maybe:
Send(SendRandomText(5))

Func SendRandomText($i_NumChars)
    Local $GatherInfo = ''
    For $x = 1 To $i_NumChars
        If Random(1, 2, 1) == 1 Then
            $GatherInfo = $GatherInfo & Chr(Random(65, 90, 1))
        Else
            $GatherInfo = $GatherInfo & StringLower(Chr(Random(65, 90, 1)))
        EndIf
    Next
    Return $GatherInfo
EndFunc
?

Edit:

Or even:

Send(SendRandomText(5))

Func SendRandomText($i_NumChars)
    Local $GatherInfo = ''
    For $x = 1 To $i_NumChars
        If Random(1, 2, 1) == 1 Then
            $GatherInfo = $GatherInfo & Chr(Random(65, 90, 1))
        Else
            $GatherInfo = $GatherInfo & Chr(Random(97, 122, 1))
        EndIf
    Next
    Return $GatherInfo
EndFunc

Edit2

Or even with numbers and letters:

Send(SendRandomText(5))

Func SendRandomText($i_NumChars)
    Local $GatherInfo = ''
    For $x = 1 To $i_NumChars
        $RanNum = Random(1, 3, 1)
        If $RanNum == 1 Then
            $GatherInfo = $GatherInfo & Chr(Random(65, 90, 1))
        ElseIf $RanNum == 2 Then
            $GatherInfo = $GatherInfo & Chr(Random(97, 122, 1))
        Else
            $GatherInfo = $GatherInfo & Random(0, 9, 1)
        EndIf
    Next
    Return $GatherInfo
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

No worries :) , but maybe:

Send(SendRandomText(5))

Func SendRandomText($i_NumChars)
    Local $GatherInfo = ''
    For $x = 1 To $i_NumChars
        If Random(1, 2, 1) == 1 Then
            $GatherInfo = $GatherInfo & Chr(Random(65, 90, 1))
        Else
            $GatherInfo = $GatherInfo & StringLower(Chr(Random(65, 90, 1)))
        EndIf
    Next
    Return $GatherInfo
EndFunc
?
nice 1 as well but i wanted to give the opportunity to choose if uppercase or lowercase or both
Link to comment
Share on other sites

  • Moderators

nice 1 as well but i wanted to give the opportunity to choose if uppercase or lowercase or both

Ahh, I see... either or, nice choices if we are right :) on the assumption.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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