[JW Lua] Create page_texts

Bart Visser bartvisser at me.com
Wed Jan 8 22:13:49 CET 2014


Hi,

Third question of the day (sorry, after a few weeks I finally found some time again to script the JW Lua).

I’m trying to build a few page-texts from scratch. I’ve put the details in a table. Somehow only the last text-block becomes visible in the score. The other first one is created but I can only view it by choosing "Edit text…" from the Text-menu.

(I’ve tried this with up to five new page-texts, every time the same thing happens: only the last one is visible, but all are created).

Any clues for how to make it work would be very much appreciated.

Thanks,


Bart Visser


local page_texts = {
["^font(Times New Roman,4096)^size(14)^nfx(0)^composer()"] = {
   ["VerticalPos"]=-510,
   ["HorizontalPos"]=0,
   ["HorizontalAlignment"]=1,
   ["PageAssignment"]=0,
   ["IndependentRightPage"]="false",
   ["PageEdgeRef"]="false",
   ["Visible"]="true",
   ["FirstPage"]=1,
   ["FrameEdgeRef"]="true",
   ["LastPage"]=1,
   ["VerticalPosRightPage"]=-510,
   ["VerticalAlignment"]=0,
   ["HorizontalAlignmentRightPage"]=1,
   ["HorizontalPosRightPage"]=0,
},

["^font(Times New Roman,4096)^size(28)^nfx(0)^title()"] = {
   ["VerticalPos"]=-249,
   ["HorizontalPos"]=0,
   ["HorizontalAlignment"]=2,
   ["PageAssignment"]=0,
   ["IndependentRightPage"]="false",
   ["PageEdgeRef"]="false",
   ["Visible"]="true",
   ["FirstPage"]=1,
   ["FrameEdgeRef"]="true",
   ["LastPage"]=1,
   ["VerticalPosRightPage"]=-249,
   ["VerticalAlignment"]=0,
   ["HorizontalAlignmentRightPage"]=2,
   ["HorizontalPosRightPage"]=0,
}

}

function set_position(text_block, tbl_data)
	for k,v in pairs(tbl_data) do
		text_block[k] = v
	end
end

for k, v in pairs(page_texts) do
	local new_item = finale.FCPageText()
	local str = new_item:CreateTextString()
	str.LuaString = k
	new_item:SaveNewTextBlock(str)
	set_position(new_item, v)
	new_item:Save(1)
end



More information about the JWLua mailing list