AppNewTimerΒΆ

AppNewTimer creates a new timer. The specified callback function will be invoked when the specified time has run down. The function is invoked until a call of AppKillTimer terminates the timer.

idTimer = AppNewTimer(ssCallback, time_ms)

Return Value

idTimer. Nonzero if successful; otherwise 0.

Parameters

ssCallback

Callback_Function is an UniScript function name. The function is invoked when the specified time has elapsed. The function has no parameters.

time_ms

time_ms specifies the time-out value, in milliseconds.

Example

def test1()
{
    log_info("", "timer", "timer 1: " + time())
}

def test2()
{
    log_info("", "timer", "timer 2: " + time())
}

AppNewTimer("test1", 3000)
AppNewTimer("test2", 6000)

Example

The following function will first stop the timer, then execute a function and then start the timer again.

RegisterCommand("2D-Datensatz", "MyCallBack_Timer", "2D-Online");
UserBar_Add("MyCallBack_Timer");

def MyCallBack_Timer()
{
    global g_timerID;

    AppKillTimer(g_timerID);
    // do something and start the timer again
    bRet = MyReadData();
    if (bRet == FALSE) {
        return FALSE;
    }
    g_timerID = AppNewTimer("MyCallBack_Timer", 60 * 1000);
    return TRUE;
}

History

Version Description
5.7.0 New.

id-1031524