.. highlightlang:: us .. index:: AppNewTimer .. _appnewtimer: AppNewTimer =========== .. us.tag AppNewTimer NOTREADYENGLISH FILE_MISC New570 :ref:`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 :ref:`AppKillTimer` terminates the timer. .. function:: idTimer = AppNewTimer(ssCallback, time_ms) .. us.return **Return Value** *idTimer*. Nonzero if successful; otherwise 0. .. us.params **Parameters** .. uparam:: ssCallback *Callback_Function* is an UniScript function name. The function is invoked when the specified time has elapsed. The function has no parameters. .. uparam:: time_ms *time_ms* specifies the time-out value, in milliseconds. .. us.example **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; } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.7.0 - New. .. seealso:: :ref:`overview-application-object`, :ref:`AppKillTimer`, :ref:`AppShowTimer` :sub:`id-1031524`