Jump to content

Do Some Functions For a Certain Amount of Time..?


Recommended Posts

You could try:

#include <GUIConstants.au3>
$timer = TimerInit()

While 1
    $Msg = GUIGetMsg()
    Switch TimerDiff($timer)
        Case 1 To 5000
            Function1()
        Case 5001 To 10000
            Function2()
        Case 10001 To 20000
            Exit

    EndSwitch
    If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func Function1()
    ConsoleWrite(@CR & " Function 1 for 5000 ms  ")
EndFunc   ;==>Function1

Func Function2()
    ConsoleWrite(@CR & " Function 2 for 5000 ms  ")
EndFunc   ;==>Function2

Hope that helps

Cheers

NBJ

Edited by NBJ
Link to comment
Share on other sites

is there any other way to do this..??

yer code looks like it will only do 2 function for 2 specific time periods..

I want to do a flow of functions in a loop for 20Min..

is there anyway to do it so i don't have to specify time periods for each specific function that i want to perform..??

that way each function can perform without a time constraint, but when the 20Min is up it moves on to the next code/functions out of the loop in the script..

is there any other way to do this like i want to do..??

Link to comment
Share on other sites

#include <GUIConstants.au3>
$timer = TimerInit()

While 1
    $Msg = GUIGetMsg()
    Switch TimerDiff($timer)
        Case 1 To 10000
            Function1()
            Function2()
        Case 10001 To 20000
            Exit

    EndSwitch
    If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func Function1()
    ConsoleWrite(@CR & " Function 1 for 5000 ms  ")
EndFunc   ;==>Function1

Func Function2()
    ConsoleWrite(@CR & " Function 2 for 5000 ms  ")
EndFunc   ;==>Function2

?

Giggity

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...