Sign in to follow this  
Followers 0
mechtn

Run a Func every XX minutes

8 posts in this topic

Hello, I'm a new AutoIT user who has just converted from using AcTool. I have a basic question about how to do something in AutoIT that I was able to do in AcTool.

In AcTool I could run a procedure (func in autoit) every XX minutes fairly easily. Using ProcessMessages in my main while loop checks all Procedures and makes them go off every XX minutes

AcTool's version would be...

Procedure Test Every 15 minutes

//stuff goes here

End

While 1=1

ProcessMessages

End

Now with AutoIt i know that I would have...

Func Test()

;~ stuff goes here

EndFunc

While 1=1

;~ not sure what to do here

WEnd

I know I could put Test() in my while statement to call it but I don't know how to make it do it every XX minutes.

Does this make sense? Can anyone please point me in the right direction?

Thanks kindly.

mechtn

Share this post


Link to post
Share on other sites



Use a Sleep() call in your loop, or use TimerInit at the start of the timer and check for when your ammount of time has elapsed.

Share this post


Link to post
Share on other sites

You could try using AdlibEnable .

Share this post


Link to post
Share on other sites

or you could use TimerInit & TimerDiff. Wow, you already have 3 solutions :)


Hi ;)

Share this post


Link to post
Share on other sites

Thanks guys. I'll look in to all of the above and find the best solution for my program. AutoIt rocks!

Share this post


Link to post
Share on other sites

Hello, I'm a new AutoIT user who has just converted from using AcTool. I have a basic question about how to do something in AutoIT that I was able to do in AcTool.

In AcTool I could run a procedure (func in autoit) every XX minutes fairly easily. Using ProcessMessages in my main while loop checks all Procedures and makes them go off every XX minutes

AcTool's version would be...

Procedure Test Every 15 minutes

//stuff goes here

End

While 1=1

ProcessMessages

End

Now with AutoIt i know that I would have...

Func Test()

;~ stuff goes here

EndFunc

While 1=1

;~ not sure what to do here

WEnd

I know I could put Test() in my while statement to call it but I don't know how to make it do it every XX minutes.

Does this make sense? Can anyone please point me in the right direction?

Thanks kindly.

mechtn

Share this post


Link to post
Share on other sites

;//Timer 

;//Call the Loop
_Loop()

Func _Loop()
    While 1
        ;//Stop Processing for nn Minutes
        _Timer()
        ;On return do Something
    WEnd
EndFunc

;//Timer
Func _Timer()   
    Local $EndMenuTimer = 50000 ;//Time Variable 
    $MenuCycle = _TimeToTicks(@HOUR, @MIN, @SEC)
    $MenuEndCycle = $MenuCycle + $EndMenuTimer
    While 1 
        ;//Exit Time after 
        If _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then
            ;//Return to Loop
            ExitLoop        
        EndIf
        ;//Pause Processing
        Sleep(1000)
    WEnd
EndFunc

Share this post


Link to post
Share on other sites

thanks for the sample code... i'll play with it in the morning...

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