Sign in to follow this  
Followers 0
anyways

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

12 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



i read it, didnt help, cant you jsut type in the code? :/

Share this post


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

cool, lets hope its working

ill try with 2 first, for testing and ill let u know

Edited by anyways

Share this post


Link to post
Share on other sites

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

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


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

Share this post


Link to post
Share on other sites

ok, searchresult owns, thanks man

Share this post


Link to post
Share on other sites

I didn't realize i would also need to indicate an "endif"

... anyways, glad you guys got there

8)


NEWHeader1.png

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