Sign in to follow this  
Followers 0
noobcoder

First attempt to code anything - need help with Do Until

6 posts in this topic

Hello,

To put it simple I'm trying to figure out a way to loop through the alphabet so I can try different key combination. I created a key and now I'm trying to figure out how to have it loop through the global part.. for example, on the first try it does $1 second try $2 etc. I high light and explain the part of the code I need help with below.

Global $1 = "a"
Global $2 = "b"
Global $3 = "c"
Global $4 = "a"
Global $5 = "d"
Global $6 = "e"
Global $7 = "f"
Global $8 = "g"
Global $9 = "h"
Global $10 = "i"
Global $11 = "j"
Global $12 = "k"
Global $13 = "l"
Global $14 = "m"
Global $15 = "n"
Global $16 = "o"
Global $17 = "p"
Global $18 = "q"
Global $19 = "r"
Global $20 = "s"
Global $21 = "t"
Global $22 = "u"
Global $23 = "v"
Global $24 = "w"
Global $25 = "x"
Global $26 = "y"
Global $27 = "z"

Local $message = 0
Do
Sleep(5000)
Send("{BS}")
Sleep(150)
Send("{BS}")
Sleep(150)
Send("{q}")
Sleep(150)
Send(<<< hmm) ; This is where I need help. I know I can not put just $message or else it will just give me 1, 2 3 etc right? Not $1, $2 which would translate to a, b etc which is what I need. I was thinking something like Send($ & $message) but of course that syntax does not work. 
sleep(150)
Send("{ENTER}")
Sleep(400)
Send("{ENTER}")
Sleep(400)
$message = $message + 1
until $message = 27

Share this post


Link to post
Share on other sites



Something like this could get ya started:

$ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
$ARRAY = StringSplit($ALPHABET, "")

For $i = 1 to $ARRAY[0]
Send('' & $ARRAY[$i])
Next

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum,

A good place to start learning AutoIt is the Wiki.

Have a look at the Getting started and the Tutorials sections.

You need something like:

Global $sAlphabet = "abcdefghijklmnopqrstuvwxyz"
$aAlphabet = StringSplit($sAlphabet, "")
For $iIndex = 1 to $aAlphabet[0]
    ConsoleWrite($aAlphabet[$iIndex] & @LF)
Next

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ahh thanks for the replys! This should set me in the right path, I feel really, really inefficient after seeing your two example codes.. so much code on my end and all over the place for so little.

Share this post


Link to post
Share on other sites

It won't take too much time and you will code as efficient as we do B)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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