theSkareqro

Pause script momentarily after x no. of presses.

3 posts in this topic

#1 ·  Posted (edited)

I want my script to loop for 300 times after which it pauses for an X amount of time before restarting.

$a = 0
Do
(my command here)
$a += 1
Until $a = 300

I know Do...Until will only run for 300 loops before it ends. Another one I figured out is:

While 1
(my command here)
wend

This will run infinitely. I'm really unsure when to insert sleep() or are there other commands to do this.
If you must know, this is my first time scripting. Thanks in advance.

Edited by theSkareqro

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!

Do not exit the loop but check if the counter is divisable by 300 and then do the needed sleep.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Local $a = 0
While 1
    (my command here)
    $a += 1
    If $a==300 Then
        Sleep(500)
        $a = 0
    EndIf
WEnd

 

Edited by computergroove
1 person likes this

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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