Sign in to follow this  
Followers 0
Noobcube

Loop but everytime change a letter

11 posts in this topic

Hi, i would like to make a script what on the first time it will type. texttext A texttext , but when it loops it will be like texttext B texttext and so on, is they a way to do this with autoit?

Thanks

Share this post


Link to post
Share on other sites



Lookup these functions and have a go:

For...Next

Chr()

Thanks ill take a look, im guess the Chr stands for character?

Share this post


Link to post
Share on other sites

Thanks ill take a look, im guess the Chr stands for character?

No need to guess when you have the help file up and running. :mellow:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

But yes, it stands for character. Check its reference page for more information. Here are all the ASCII codes:

Posted Image

Edited by d4ni

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Looking at the help files i came up with this

$text = ""
For $i = 97 to 122 Step 1
    $text = $text & Chr($i)
Next
MsgBox(0, "Uppercase alphabet", $text)

however this just opens a msg box with abcdefg.... etc. I need it so first time a msg box will show with a, i close it then one with b opens, etc. How would i go about changing my code for this to work?

EDIT

sleep(2000)
$text = ""
For $i = 97 to 122 Step 1
   send("Text sample , letter $i")
Next

so far i think this will work, however it types Text sample , letter $i, how do i tell it not to type $a but to find its value if you understand what i mea

PS: Thanks d4ni :mellow:

Thanks

Edited by Noobcube

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

For $i = 97 to 122 ; Lowercase = 65 through 90
    $text = Chr($i)
    MsgBox(0, "Uppercase alphabet", $text)
Next

Although that's not uppercase, it's lowercase :(

Btw, use autoit tags, not code tags :mellow:

~ edit

I didn't see that edit of yours, but to answer the question:

so far i think this will work, however it types Text sample , letter $i, how do i tell it not to type $a but to find its value if you understand what i mea

PS: Thanks d4ni

Thanks

The easiest way it to use this:

Sleep(2000)
For $i = 97 to 122
   Send("Text sample , letter " & $i) ; Or you can set AutoitSetOption(ExpandVarStrings, 1) and use "Text sample, letter $i$" -- notice the 2nd $ though.
Next
Edited by d4ni

Share this post


Link to post
Share on other sites

i used

sleep(2000)
$text = ""
For $i = 97 to 122 Step 1
   send("Text sample , letter " & $i)
Next

and it works great thanks :mellow:

i need this for my website, im adding photos to a page, and i have 150+ photos labeled a b c d etc, then aa ab ac so this will speed up my coding no end :(

Share this post


Link to post
Share on other sites

ive come across another issue, the code i need to send it

<td><a href='becciresize/$text$".jpg' target='_new' title='Click to enlarge'>

<img src='becciresize/$text$.jpg' width=100 height=75 border=0></a>

<br>

Photo1</td>

however its coming up with the error

C:\Users\TomHart0\Desktop\alphabet.au3 (15) : ==> Unterminated string.:

send("<td><a href='becciresize/$text$".jpg' target='_new' title='Click to enlarge'>

im guessing thats because it has <> in it, is there a way i can get it to type all that out include referencing $text$ to tput the letters a,b,d etc in it

thanks

Share this post


Link to post
Share on other sites

Show the whole record where you have the error on, but in general: When you need a double quote inside a String that has double quotes at the start end end you need to double them up.

eg: this string: test "a" example

should be: $test = "test ""a"" example"

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

i used

sleep(2000)
$text = ""
For $i = 97 to 122 Step 1
   send("Text sample , letter " & $i)
Next

and it works great thanks :mellow:

i need this for my website, im adding photos to a page, and i have 150+ photos labeled a b c d etc, then aa ab ac so this will speed up my coding no end :(

If you are doing this for a website, you might look into learning PHP or another web scripting language. It'll give you much more flexibility for your website, and make your webpage code *much* easier to read.


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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