I'm looking at the scripting interface, and I don't think the scripting dictionary has access to how many times an interval cue has been fired so far.
I've been able to work around this using script properties, but that's kind of fragile -- if I have to reset the document or something else that prevents the counter from being reset, I have to do it by hand. The goal here is to pop up a notification a certain number of times during the activity to let me know how much time is left. Here's the script I'm using.
property timesToFire : 10
property timesFired : 0
using terms from application "FlexTime"
on HandleFlexTimeCue(myDocument, myRoutine)
if timesFired is not equal to timesToFire then
set timesFired to timesFired + 1
set timesFired to 0
set activityName to name of myRoutine
set timeUnits to (base unit of myRoutine as string)
set timeToRun to numeric duration of myRoutine as integer
set timeSlice to timeToRun / timesToFire
set timeLeft to (timeToRun - (timesFired * timeSlice))
set myMessage to "Time left for " & activityName & ":
" & timeLeft & " " & (timeUnits as string) & ""
display message myMessage at screen position top left dismissing after delay 1
end using terms from
By the way, the using terms from business was the only way I was able to get the dang thing to compile on 10.4.7 in Script Editor. Am I missing something there?