Sign in to follow this  
Followers 0
Jdurant

A Rolling Alphabet Into A Var

15 posts in this topic

What I'm trying to do here is to get a function to input into a var each letter of the alphabet

ie:

Send, %varalphy%

where varalphy = A at first and then B the next time and then C the time after that and so on.

Share this post


Link to post
Share on other sites



Not quite sure exactly what you are trying to do but you could use a loop with the StringMid function if you want to enter each letter seperately.

Share this post


Link to post
Share on other sites

try checking out the count examples

Share this post


Link to post
Share on other sites

Not quite sure exactly what you are trying to do but you could use  a loop with the StringMid function if you want to enter each letter seperately.

Does this help?

$ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$Num = 0

While $Num <= 26

$Letter = StringMid( $ABC, $Num, 1)
MsgBox(0, "Next Letter is: ", $Letter)

$Num = $Num + 1
WEnd

-Brett

Share this post


Link to post
Share on other sites

well, that has the general idea of what I was going for.

basiclly

repeat, 26

send, %var%

endrepeat

which would output:

var = A the first time

var = B the 2nd time

var = C the 3rd time

Share this post


Link to post
Share on other sites

u could just change the msgbox to Send

$ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$Num = 0

While $Num <= 26

$Letter = StringMid( $ABC, $Num, 1)
Send ($Letter)

$Num = $Num + 1
WEnd

-Brett

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

MsgBox(1,"Hello Everyone","I will now count from A to Z")
$x=""
For $i=1 To 26
tooltip(chr($i+64))
sleep(500)  
Next

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

or

$alpha=StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z",",")
For $i=1 To $alpha[0]
MsgBox(1,"Letter "& $i,$alpha[$i],1)
Next    

;or
$alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
While $alpha<>""
    MsgBox(1,"Alternate Method",StringLeft($alpha,1),1)
    $alpha=StringTrimLeft($alpha,1)
Wend

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks guys, I'll give these a try and see which one works out best.

Again thanks!! :D

Share this post


Link to post
Share on other sites

I would instinctively go with ScriptKitty's Chr() option .. but I see StringSplit has a cool feature that allows you to split undelimited strings..

$asLetter = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ","")

Cool hey :D

Share this post


Link to post
Share on other sites

$alpha = StringSplit("a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z", "|")

$count = 0

While 1 
     $count = $count + 1
     If $count > 26 then exitloop
     MsgBox(4096, "Results", $alpha[$count])
Wend


We have enough youth. How about a fountain of SMART?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

smallest codification! (yet)

For $a = Asc("a") to Asc("z")
     $Letter = Chr($a)
Next

:D

Edit: Argh... How stupid... I didn't see the scriptkitty code :huh2:

Still... The shortest anyway.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

only because I put in a sleep.

For $i=1 To 26
tooltip(chr($i+64))
sleep(500)
Next

tooltip display goes too fast without it,

This is about my smallest version, of course no display.

For $i=65 To 90; use chr($i) for your letter.
Next

smallest codification! (yet) :D


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

This is about my smallest version, of course no display.

For $i=65 To 90; use chr($i) for your letter.
Next
The objective was "Rolling Alphabet into a var" so you script is not valid!

Without telling that you're code isnt the shortest (yet) I'll change it to make it valid :D

For $i=65 To 90
$l=chr($i)
Next

Now it is ok... Al the alphabet rolling in a var in only 31 bytes... ok... 33 if you are using @crlf(s)

Share this post


Link to post
Share on other sites

ok, got me on that one. Dang technicalities. Think I read the questions?

:D


AutoIt3, the MACGYVER Pocket Knife for computers.

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