Sign in to follow this  
Followers 0
Jjames

Queues and timers

5 posts in this topic

Hey, I have searched these forums and the autoit help but have not been able to find what i need, so hopefully one of you will be able to help me.

My ultimate goal with the program is to have 3 functions that run lets say every 15,30,50 secs. (Func 1 being every 15 secs, Func2 ever 30, Func3 every 50)

My idea to do this was to have 3 timers that when finished would reset and push the func onto a queue, which the program would be continously watching. Except I can't find any timers other then _Timer_SetTimer which seems to require a GUI which I don't want. Is there another type of timer/clock something of the sort that is able to be run in the background.

Share this post


Link to post
Share on other sites



$timer = 0

While 1
    Sleep(1000)
    $timer += 1
    If Mod($timer, 15) = 0
        func1()
    EndIf
    If Mod($timer, 30) = 0
        func2()
    EndIf
    If Mod($timer, 50) = 0
        func3()
    EndIf
WEnd

Func func1()
EndFunc

Func func2()
EndFunc

Func func3()
EndFunc


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That's close to what my initial idea was and I might just end up doing that. However, is there some kind of timer feature?

Edited by Jjames

Share this post


Link to post
Share on other sites

See the help file.

Share this post


Link to post
Share on other sites

My idea to do this was to have 3 timers that when finished would reset and push the func onto a queue, which the program would be continously watching. Except I can't find any timers other then _Timer_SetTimer which seems to require a GUI which I don't want. Is there another type of timer/clock something of the sort that is able to be run in the background.

Come on now, you are already running hundreds of windows, how can 1 more be of any problem?

If you really can't waste a few (kilo?)bytes of ram then upgrade to latest beta and use AdlibRegister().

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