Jump to content

something not working right....


-TS-
 Share

Recommended Posts

im trying to make a random set 5 to 15letters/numbers

$A = Random( 5 , 15 )

$a2 = 1

do

$a2 = $a2 + 1

$Abc123 = Random( 1 , 36 )

if $Abc123 = 1 then

Endif

send("a")

if $Abc123 = 2 then

Endif

send("b")

if $Abc123 = 3 then

Endif

...

if $Abc123 = 36 then

Endif

send("0")

until $a2 = $A

but it alweys comes up with abcde.....

THX *TS*

Link to comment
Share on other sites

So what was the problem?

Anyway, you could greatly simply your code with the CHR command....

$Abc123 = Random( 1 , 36 )

If $Abc123 > 26 Then;numbers 0-9
    Send( Chr(27 + $Abc123) )
Else;letters a-z
    Send( Chr(96 + $Abc123) )
EndIf

Here's a chart for your reference:

Chr(48) == "0" ... Chr(57) == "9"

...

Chr(65)== "A" ... Chr(90) == "Z"

...

Chr(97) = "a" ... Chr(122) == "z"

Maybe you will find this useful

EDIT: Also, the select case command could come in handy.

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

I just realized a slightly more straight-forward way:

$alphabet = "abcdefghijklmnopqrstuvwxyz1234567890"

$Abc123 = ""
For $i = 1 to Random(5,15)
  $Abc123 = $Abc123 & StringMid($alphabet, Random(1,36), 1) 
Next

Send($Abc123)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...