Jump to content

Elegant way to perform a time-query?


Recommended Posts

Hi

I'm still quite new with AutoIt and i wonder how to script (most elegantly) this:

I want to perform a job (a function or something else - dosen't matter) inside the script at exactly a specific time, e.g. every day at 11:00h. The script should always be running (sleeping?) and at this time do something once. Then the script again should wait for the next day 11:00h and so on...

How do i script this "time-query" most elegantly? :D

Thanks for all suggestions!

Roman.

Link to comment
Share on other sites

Hi,

While 1

Sleep(30000)

If @Hour = 11 And @Min = 00 Then ...

Wend

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

While 1

Sleep(30000)

If @Hour = 11 And @Min = 00 Then ...

Wend

Thanks. I did this already, but additional with "... AND If @SEC = 0", because it needs to be exactly on 11:00:00h. The problem now is that if the script does meanwhile something else, it could miss this one second for the query and do nothing.

Probably my question was imprecisely.

Thanks again.

Roman.

Link to comment
Share on other sites

Why not compile whatever you need to do into an exe and use Windows Scheduler to run it at precisely 11 or whatever time you need it run?

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Link to comment
Share on other sites

$FinePrecision = 100

While 1
Sleep(30000)
If @Hour = 10 And @Min = 59 And @Sec > 30 Then
While @Sec <> 0
Sleep($FinePrecision)
Wend

PerformFn()
EndIf

Wend

If I am too verbose, just say so. You don't need to run on and on.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...