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


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


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


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"


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

(19.83 KiB) Downloaded 216 times
Posts: 1130
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