Retrieves the timer handle for the specified timer name.
TimerGetHandle (sName)
Variable | Description |
---|---|
sName | The timer name. STRING. |
TimerGetHandle returns the timer handle, hTimer, for the specified timer name, sName. If the timer handle is invalid, an exception is returned.
There is no check if the timer name is used multiple times. TimerGetHandle returns the first timer handle for the matching timer name. This function is provided for interfacing with Silk Performer; it is not needed for Silk Test Classic scripts.
[-] testcase timertest () appstate none [ ] [ ] HANDLE hTimer [ ] HANDLE hTimer2 [ ] STRING sTimerName [ ] STRING sReturnName [ ] [ ] // Create timer [ ] hTimer = TimerCreate () [ ] [ ] // Get the default name of the timer [ ] sReturnName = TimerGetName (hTimer) [ ] [ ] // Print returned name "Timer0" [ ] print (sReturnName) [ ] [ ] // Set timer name to "Timer0" [ ] sTimerName = "Timer0" [ ] [ ] // Create timer with name (for SilkPerformer) [ ] hTimer2 = TimerCreate ("Timer0") [ ] [ ] // Get the name of the second timer and print it [ ] sReturnName = TimerGetName (hTimer2) [ ] Print (sReturnName) [ ] [ ] // Prints timer name "Timer0" [ ] Print (TimerGetHandle (sReturnName))