-1

I want my AutoIt script to run every 20 minutes without using Sleep(). I cannot buy any software; is there freeware which can do this?

user4157124
  • 2,809
  • 13
  • 27
  • 42
bloody mary
  • 7
  • 1
  • 2

5 Answers5

2

Have you tried Task Scheduler on windows? (it's built-in most of windows versions) It depends on your windows version, but if you set up an advanced task, you can make it run every x minutes

olivarra1
  • 23
  • 3
1

see AdlibRegister function in autoit help

虫子樱桃
  • 102
  • 6
1

Well actually you can do this in various ways with autoit too... I don't know if with "no sleep" you mean you don't want to keep the program open. If so, you can write your own autoit program to run your .exe autoit script every 20 mins.

Or you can do it in your own script by checking the system clock.

Gbgf Ggf
  • 11
  • 1
  • 2
0

Sleep() is important if you want the script to be running constantly. You can do something like this to get a 20 minute wait:

While 1
$timer = TimerInit()
Do
    If TimerDiff($timer) > 1200000 Then
        MsgBox (0,"Timer Alert","The timer has hit 20 minutes!")
    EndIf
Until TimerDiff ($timer) > 1200000
WEnd

Without Sleep() at all, it's going to be eating up a good amount of CPU since it's checking the timer as fast as it possibly can. Plus, you run a very small chance being at 1199999 ms when the first IF checks, and being at 1200001 when it evaluates the Until and it would skip the message.

Your best bet is to just make your script do whatever, then use Windows Task Scheduler to run every 20 minutes. Though when I checked, there's no option for every 20 minutes.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Eremite
  • 7,995
  • 2
  • 13
  • 6
0

Use _Timer_SetTimer() to set a timer you want without Sleep().

user4157124
  • 2,809
  • 13
  • 27
  • 42
necu
  • 9
  • 1