Jump to content

Loop but everytime change a letter


Noobcube
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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!

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...