# something not working right....

## 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*

##### Share on other sites

o my nvm that i saw the problem.... LMAO

##### 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!

##### Share on other sites

na i found out what i was doing wrong the endif statement is befor the if command

##### Share on other sites

Still, take a look at my suggested code.....

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

##### Share on other sites

thx, that looks like it would save 200+ lines of codes

##### 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!

##### Share on other sites

o wow, i guess i should read and play with all the commands... THX

## Create an account

Register a new account

×

• Wiki

• Back

• Git