Sign in to follow this  
Followers 0
-TS-

something not working right....

8 posts in this topic

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 this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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 this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 this post


Link to post
Share on other sites

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

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