Sign in to follow this  
Followers 0
rabbitkillrun

Letter list generator...

4 posts in this topic

#1 ·  Posted (edited)

Ok, so for about an hour now i've been trying to figure out how to make a list of letters like this:

a

b

c

d

...

zzzzy

zzzzz

problem is, because the ascii codes of upper and lower case letters, and numbers are seperated, the code i've got won't work to create a list with all these...

can anyone find a solution to this...?

here's what i've got so far... (couldn't get lots of nested loops to work...):

for $l1 = 97 to 122
    $word = chr($l1)
    ConsoleWrite($word&@CRLF)
next

for $l2 = 97 to 122
    for $l1 = 97 to 122
    $word = chr($l2) & chr($l1)
    ConsoleWrite($word&@CRLF)
    next
next
            
for $l3 = 97 to 122
    for $l2 = 97 to 122
        for $l1 = 97 to 122
        $word = chr($l3) & chr($l2) & chr($l1)
        ConsoleWrite($word&@CRLF)
        next
    next
next

for $l4 = 97 to 122
    for $l3 = 97 to 122
        for $l2 = 97 to 122
            for $l1 = 97 to 122
            $word = chr($l4) & chr($l3) & chr($l2) & chr($l1)
            ConsoleWrite($word&@CRLF)
            next
        next
    next
next

for $l5 = 97 to 122
    for $l4 = 97 to 122
        for $l3 = 97 to 122
            for $l2 = 97 to 122
                for $l1 = 97 to 122
                $word = chr($l5) & chr($l4) & chr($l3) & chr($l2) & chr($l1)
                ConsoleWrite($word&@CRLF)
                next
            next
        next
    next
next
Edited by rabbitkillrun

Share this post


Link to post
Share on other sites



thanks... i tried searching, but i couldn't think of the right search term...

although it still doesn't really help much with my problem with the gaps between the ascii characters...

Share this post


Link to post
Share on other sites

sorry for digging up this old topic to answer my own question, but thought it could be useful to another autoit newb in the future...

i just created an array containing all the characters i wanted and went through charList[$i] rather than using char($i)...

i can't see how i managed to miss that before... :) i guess that's what late night programming does to you... :)

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