Sign in to follow this  
Followers 0
anyways

Any Function to repeat a script?

8 posts in this topic

#1 ·  Posted (edited)

What function i should use to repeat a script when it reaches the end (or when its done)?

and is there a way to tell autoit to stop when lets say i press esc?

Edited by anyways

Share this post


Link to post
Share on other sites



What function i should use to repeat a script when it reaches the end (or when its done)?

and is there a way to tell autoit to stop when lets say i press esc?

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

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search

Share this post


Link to post
Share on other sites

What function i should use to repeat a script when it reaches the end (or when its done)?

and is there a way to tell autoit to stop when lets say i press esc?

Learn to do Loops

HotkeySet("{ESC}","_Quit")
HotkeySet("{PAUSE}","_Func")
Global $Bool=0
While 1
Sleep(1)
WEnd
Func _Quit()
Exit
EndFunc
Func _Func()
$Bool=Not $Bool
While $Bool
;Do stuff
WEnd
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ok, you both showed me a way to end the script by clicking esc, but u didnt tell me what function to use if i want the script to repeat itself when its done?

Edited by anyways

Share this post


Link to post
Share on other sites

:rolleyes:

Global $RepeatScript = 2 ;How many times your script will repeat. 1 = once.
HotKeySet("{ESC}","_Exit") ;This makes the script exit on ESC
For $i = 1 To $RepeatScript
MsgBox(0,"","This is " & $i & ". message box!") ;wow what a discovery =)
;Rest of your script goes here
Sleep(500) ;Gives user a chance to quit - if you will use multi lines then delete this command =)
Next
;Here goes something if you want after the script is repeated.
Func _Exit() ;This is the exit command
;Here goes something if you want before exit command
Exit
EndFunc

Not tested :rambo:


I can do signature me.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#Include <Misc.au3>
While Not _IsPressed ( "1B" , 'user32.dll' )
;Your Program Goes in the HERE!
Wend
lol i figured that out later, thanks though it works, btw is there a default key on the keyboard to pause or stop the autoit script? Edited by anyways

Share this post


Link to post
Share on other sites

lol i figured that out later, thanks though it works, btw is there a default key on the keyboard to pause or stop the autoit script?

In SciTE I see F5 to run, and Ctrl+break to Stop Executing.

[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

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