THTimer

Here is where the magnanimous folks that create externals post them (.zip archives only please).

THTimer

Postby sctell » Tue Sep 13, 2011 4:42 am

Hi,

A small external to setup a timer. This is based upon Cocoa's NSTimer class.

Instructions/Syntax:
Syntax:

put THTimer ("startTimer","timerAction","this project",tPeriod,tRepeats) into gMyTimer

"timerAction" - The SC routine(message) to be sent from the external

"this project" - The message is sent to the project or "cd btn id 100" or "this cd" etc.

tPeriod - The number of seconds between firings of the timer. If seconds is less than or equal to 0.0, "startTimer" chooses the nonnegative value of 0.1 milliseconds instead.

tRepeats - If true, the timer will repeatedly reschedule itself until stopped. If false, the timer will be stopped after it fires.

put THTimer ("stopTimer",gMyTimer) into tInfo

gMyTimer - this is the timer reference returned from "startTimer"

NOTES:

Once scheduled, the timer fires at the specified interval until it is stopped.
A non-repeating timer stops itself immediately after it fires.
However, for a repeating timer, you must stop the timer object yourself by calling its stopTimer method.
You can setup more than one timer.

I haven't checked this but as the timer is running independently of SC there could be a situation where the time fires before the action issued to SC previously has finished. Please be aware of this.


All the best

Terry

THTimerTest.zip
(19.83 KiB) Downloaded 211 times
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest