Jump to content

is autoit able to generate letters?


 Share

Recommended Posts

is autoit able to generate letters?

for example I want to generate a list of letters with 2 letters max, then write them to notepad with filewrite.

currently I have it like this:

$length = 2

$a = 'a'

$b = 'b'

$c = 'c'

$d = 'd'

$e = 'e'

$f = 'f'

$g = 'g'

$h = 'h'

$i = 'i'

$j = 'j'

$k = 'k'

$l = 'l'

$m = 'm'

$n = 'n'

$o = 'o'

$p = 'p'

$q = 'q'

$r = 'r'

$s = 's'

$t = 't'

$u = 'u'

$v = 'v'

$w = 'w'

$x = 'x'

$y = 'y'

$z = 'z'

If $list = 2 Then

FileWrite("list.txt", $a & $a & @CRLF)

FileWrite("list.txt", $b & $b & @CRLF)

FileWrite("list.txt", $c & $c & @CRLF)

FileWrite("list.txt", $d & $d & @CRLF)

FileWrite("list.txt", $e & $e & @CRLF)

FileWrite("list.txt", $f & $f & @CRLF)

FileWrite("list.txt", $g & $g & @CRLF)

FileWrite("list.txt", $h & $h & @CRLF)

FileWrite("list.txt", $i & $i & @CRLF)

FileWrite("list.txt", $j & $j & @CRLF)

FileWrite("list.txt", $k & $k & @CRLF)

FileWrite("list.txt", $l & $l & @CRLF)

FileWrite("list.txt", $m & $m & @CRLF)

FileWrite("list.txt", $n & $n & @CRLF)

FileWrite("list.txt", $o & $o & @CRLF)

FileWrite("list.txt", $p & $p & @CRLF)

FileWrite("list.txt", $q & $q & @CRLF)

FileWrite("list.txt", $r & $r & @CRLF)

FileWrite("list.txt", $s & $s & @CRLF)

FileWrite("list.txt", $t & $t & @CRLF)

FileWrite("list.txt", $u & $u & @CRLF)

FileWrite("list.txt", $v & $v & @CRLF)

FileWrite("list.txt", $w & $w & @CRLF)

FileWrite("list.txt", $x & $x & @CRLF)

FileWrite("list.txt", $y & $y & @CRLF)

FileWrite("list.txt", $z & $z & @CRLF)

FileWrite("list.txt", $a & $z & @CRLF)

FileWrite("list.txt", $b & $y & @CRLF)

FileWrite("list.txt", $c & $x & @CRLF)

FileWrite("list.txt", $d & $w & @CRLF)

FileWrite("list.txt", $e & $v & @CRLF)

FileWrite("list.txt", $f & $u & @CRLF)

FileWrite("list.txt", $g & $t & @CRLF)

FileWrite("list.txt", $h & $s & @CRLF)

FileWrite("list.txt", $i & $r & @CRLF)

FileWrite("list.txt", $j & $q & @CRLF)

FileWrite("list.txt", $k & $p & @CRLF)

FileWrite("list.txt", $l & $o & @CRLF)

FileWrite("list.txt", $m & $n & @CRLF)

FileWrite("list.txt", $n & $m & @CRLF)

FileWrite("list.txt", $o & $l & @CRLF)

FileWrite("list.txt", $p & $k & @CRLF)

FileWrite("list.txt", $q & $j & @CRLF)

FileWrite("list.txt", $r & $i & @CRLF)

FileWrite("list.txt", $s & $h & @CRLF)

FileWrite("list.txt", $t & $g & @CRLF)

FileWrite("list.txt", $u & $f & @CRLF)

FileWrite("list.txt", $v & $e & @CRLF)

FileWrite("list.txt", $w & $d & @CRLF)

FileWrite("list.txt", $x & $c & @CRLF)

FileWrite("list.txt", $y & $b & @CRLF)

FileWrite("list.txt", $z & $a & @CRLF)

EndIf

and that will require a lot of time to when I try to generate 3+ letters

Edited by will88
Link to comment
Share on other sites

is autoit able to generate letters?

for example I want to generate a list of letters with 2 letters max, then write them to notepad with filewrite.

currently I have it like this:

and that will require a lot of time to when I try to generate 3+ letters

Learn to use For/Next loops before you go any further!
$sMsg = ""
For $iLower = 97 To 122
    For $iUpper = 65 To 90
        $sMsg &= Chr($iLower) & ", " & Chr($iUpper) & @CRLF
    Next
Next

ConsoleWrite($sMsg)

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Learn to use For/Next loops before you go any further!

$sMsg = ""
For $iLower = 97 To 122
    For $iUpper = 65 To 90
        $sMsg &= Chr($iLower) & ", " & Chr($iUpper) & @CRLF
    Next
Next

ConsoleWrite($sMsg)

;)

thanks, that will be helpful

$sMsg = ""
For $iLower = 97 To 122
    For $iUpper = 65 To 90
        $sMsg &= Chr($iUpper) & @CRLF
    Next
Next

ConsoleWrite($sMsg)

;MsgBox(0, "", $sMsg)

FileWrite("test.txt", $sMsg)

65 to 90 is A-Z, but when I run the above code it writes it like 20 times, what tells it to write it 20 times? :S

Edited by will88
Link to comment
Share on other sites

$sMsg = ""
For $iLower = 97 To 122; <--- This makes it to write it 20 times
    For $iUpper = 65 To 90
        $sMsg &= Chr($iUpper) & @CRLF
    Next
Next

65 to 90 is A-Z, but when I run the above code it writes it like 20 times, what tells it to write it 20 times? :S

You have put a loop inside another loop. The inner loop repears for every step of the outer loop and this makes it to do the same thing 20 times.

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

You have put a loop inside another loop. The inner loop repears for every step of the outer loop and this makes it to do the same thing 20 times.

Actually, 26 times. The outer loop is lower case a thru z, and the inner loop is upper case A thru Z. Hence the iterated variable's names: $iLower and $iUpper.

Looking at the output should have shown that.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...