Jump to content
Sign in to follow this  
anyways

Any Function to repeat a script?

Recommended Posts

anyways

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
Kogmedia

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
Generator

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
anyways

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
i542

: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
anyways

#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
BullGates

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  

×