neltisen Posted November 19, 2007 Share Posted November 19, 2007 Hello, I was using AutoIt (I think it was AutoIt, but I'm not sure) around half year ago. For few months I forgot about its (even name, I had full disc format, so I'm not sure if it was this app ). Through this time I have completly forgotten my scripts, but I remember something like this: $id = 1 loop 1000 send ( "add skill" $id) sleep 200 $id += 1 (this macro was usable to learn all abilities in HoMM V ) I know that I can use For...until in exchange, but what when I don't need var in my script? example: loop 20 send ( "wtb g40 stuff" ) sleep 1000 how to use loop here only for (as example) 20 times? Link to comment Share on other sites More sharing options...
FireLord Posted November 19, 2007 Share Posted November 19, 2007 you could do like this: $i=0 Do ; code $i = $i+1 Until $i = 20 It would increment I until it equals 20 so you would keep looping 20 times [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
weaponx Posted November 19, 2007 Share Posted November 19, 2007 For $X = 1 to 20 Next Link to comment Share on other sites More sharing options...
John117 Posted November 19, 2007 Share Posted November 19, 2007 I perfer the method weaponx listed. -It just seems cleaner/ easier. When I am in question, I just adapt these from VBA CODESub Main() DoLoop WhileWend ForNext ForEach SpecialCells EndDown End Sub Private Sub DoLoop() Dim r As Range Set r = Range("a1") Do Until IsEmpty® Or r.Row = Rows.Count Set r = r.Offset(1) Loop End Sub Private Sub WhileWend() Dim r As Range Set r = Range("a1") While Not IsEmpty® And r.Row <> Rows.Count Set r = r.Offset(1) Wend End Sub Private Sub ForNext() For i = 1 To Application.WorksheetFunction.CountA(Range("A:A")) If IsEmpty(Cells(i, 1)) Then Exit For Next i End Sub Private Sub ForEach() Dim r As Range For Each r In Range("A:A").Cells If IsEmpty® Then Exit For Next r End Sub Private Sub SpecialCells() Set r = Range("A:A").SpecialCells(xlCellTypeBlanks) End Sub Private Sub EndDown() Dim r As Range Set r = Range("a1") Select Case True Case IsEmpty® ' do nothing Case IsEmpty(r.Offset(1)) Set r = r.Offset(1) Case Else Set r = r.End(xlDown).Offset(1) End Select End Sub Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now