Comments on: FlexTime Scripted Cues Official blog of Red Sweater Software Fri, 09 Oct 2015 20:11:22 +0000 hourly 1 By: Ryan Ballantyne Wed, 09 Aug 2006 02:40:40 +0000 Funny thing; I put <pre> tags in too, and they didn’t stick.

By: Daniel Jalkut Mon, 07 Aug 2006 18:10:01 +0000 Ryan: Awesome! I’m really glad you’re playing with the scripting interface and making good progress with it. I took the liberty of putting “<pre>” tags around your script to improve the readability.

The problem with the timing getting messed up on time-intensive scripted cues is something I hope to improve in the “engine” of FlexTime as time goes on. I am currently sort of firing the cue directly from the engine but over time I hope to make it so it sort of “spins off” the cue mechanism and allows the timing to continue completely uninterrupted.

By: Ryan Ballantyne Mon, 07 Aug 2006 17:50:32 +0000 The scripting support in this release feels silky smooth (if such superlatives can be meaningfully applied to scripting support, that is).

This post has made me realize that you can use the scripting support to create new types of cues. For example, here’s one that creates a countdown (or up):

on HandleFlexTimeCue(theDocument, theActivity)
	--Parameters are set by the cue name. The format is:
	-- Count up|down numReps beatDuration [cueSound]
	-- where up or down specifies the direction of the count,
	-- numReps specifies how many counts to make,
	-- and beatDuration tells how long (in seconds) each count should take.
	-- The optional cueSound is a string of the name of the sound that should be played on each beat.
	set text item delimiters to " "
	tell application "FlexTime"
		set actName to name of theActivity
		set paramsList to get text items of actName
		set numReps to item 3 of paramsList
		set beatDuration to item 4 of paramsList
		set upOrDown to item 2 of paramsList
		if upOrDown is "down" then
			set cnt to numReps
			set cnt to 1
		end if
		repeat numReps times
			display message cnt dismissing after delay beatDuration
			delay beatDuration
			if upOrDown is "up" then
				set cnt to cnt + 1
				set cnt to cnt - 1
			end if
		end repeat
	end tell
end HandleFlexTimeCue

So awesome. I love Applescript.

I wanted to make it say the count, too, but the time it took to speak the number messed with the timing of the beats. Hmm…