I'm posting this for future reference, sort of work-in-progress to refer to. The following script collects information on letter and number rehearsal marks and displays them in the JWLua output window.
A possible goal in the future would be to convert rehearsal marks to bookmarks, as requested in a Facebook discussion. Obviously, JWLua does not have access to Finale's bookmarks, so no luck up to now.
Code: Select all
-- Goal is to convert rehearsal marks to bookmarks.
-- Up to now, JWLua doesn't have access to Finale's bookmarks, so the script simply collects information
local Count_REHMARKSTYLE_LETTER = 0
local Count_REHMARKSTYLE_NUMBER = 0
-- Rehearsal marks offsets aren't taken into account in this first version
local measures = finale.FCMeasures()
measures:LoadAll()
for meas in each(measures) do
local expressions = finale.FCExpressions()
expressions:LoadAllForItem( meas.ItemNo ) -- Load all elements for measure 1
for e in each(expressions) do
local ted= finale.FCTextExpressionDef()
ted:Load( e.ID )
local str = finale.FCString()
if ted:IsAutoRehearsalMark() == true then
-- only two rehearsal mark styles are covered: simple letters and numbers. For all styles, see
-- http://www.finaletips.nu/frameworkref/class_f_c_text_expression_def.html#a7cd4431a7e5fe768a26eedb47759ba48
if ted.RehearsalMarkStyle == finale.REHMARKSTYLE_LETTER then
-- Rehearsal style: Letters only (upper-case)
Count_REHMARKSTYLE_LETTER = Count_REHMARKSTYLE_LETTER + 1
-- works only for one-digit rehearsal marks, code needs enhancement to cover extended ones (AA, BB..)
str = string.char( 64+Count_REHMARKSTYLE_LETTER )
end
if ted.RehearsalMarkStyle == finale.REHMARKSTYLE_NUMBER then
-- Rehearsal style: Numbers only
Count_REHMARKSTYLE_NUMBER = Count_REHMARKSTYLE_NUMBER + 1
str = Count_REHMARKSTYLE_NUMBER
end
print ("Measure ",meas.ItemNo , " contains rehearsal mark ",str)
end
end
end