Jump to content

I want that my scirpt repeat itself 30 times before ending, how?


Recommended Posts

A friend told me that this code (below) will let me repeat a script indefinitly. Now he is unavailable, so i was asking myself what should i add to this code so the script repeats itself only 30 times.

#Include <Misc.au3>
#Include <Date.au3>
While Not _IsPressed ( "1B" , 'user32.dll' )
; My script
ConsoleWrite(@CRLF&_Now())
WEnd

thanks

Edited by anyways
Link to comment
Share on other sites

A friend told me that this code (below) will let me repeat a script indefinitly. Now he is unavailable, so i was asking myself what should i add to this code so the script repeats itself only 30 times.

#Include <Misc.au3>
#Include <Date.au3>
While Not _IsPressed ( "1B" , 'user32.dll' )
; My script
ConsoleWrite(@CRLF&_Now())
WEnd

thanks

try this

#Include <Misc.au3>
#Include <Date.au3>



For $i = 0 To 30
If Not _IsPressed ( "1B" , 'user32.dll' )
; My script
ConsoleWrite(@CRLF&_Now())
Next
Link to comment
Share on other sites

If Not _IsPressed ( "1B" , 'user32.dll' ) .... Then ????

8)

you are right i forgot

#Include <Misc.au3>
#Include <Date.au3>



For $i = 0 To 30
If Not _IsPressed ( "1B" , 'user32.dll' ) Then
; My script
ConsoleWrite(@CRLF&_Now())
Next
Edited by searchresult
Link to comment
Share on other sites

now i am having the error: "next" statement with no matching "for"

i am trying your code with the example msgbox that comes with autoit

#Include <Misc.au3>
#Include <Date.au3>
For $i = 0 To 2
If Not _IsPressed ( "1B" , 'user32.dll' ) Then
    
MsgBox(0, "AutoIt Example", "This is line 1" & @CRLF & "This is line 2" & @CRLF & "This is line 3")

ConsoleWrite(@CRLF&_Now())
Next
Edited by anyways
Link to comment
Share on other sites

now i am having the error: "next" statement with no matching "for"

i am trying your code with the example msgbox that comes with autoit

#Include <Misc.au3>
#Include <Date.au3>
For $i = 0 To 2
If Not _IsPressed ( "1B" , 'user32.dll' ) Then
    
MsgBox(0, "AutoIt Example", "This is line 1" & @CRLF & "This is line 2" & @CRLF & "This is line 3")

ConsoleWrite(@CRLF&_Now())
Next
you need endif

here is working version

#Include <Misc.au3>
#Include <Date.au3>

For $i = 0 To 2
    
If Not _IsPressed ( "1B" , 'user32.dll' ) Then
    
MsgBox(0, "AutoIt Example", "This is line 1" & @CRLF & "This is line 2" & @CRLF & "This is line 3")

ConsoleWrite(@CRLF&_Now())

EndIf

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