[JW Lua] Page/Part questions

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Sun Sep 22 21:39:31 CEST 2013


On 2013-09-22 21:09, Charles O. Lawrence wrote:

> In looking at this, I see no property or method to modify a page
> attribute portrait/landscape, like there is for width, height, and
> margins.  Not even on the FCPage class PDF document.  Am I missing
> something?

Finale doesn't support "portrait/landscape" in the data, and I have not 
had much need to implement it myself as a method. If the width is wider 
than the height, it's considered to be landscape, otherwise it's portrait.

However, I see the need at least to have a FCPage:IsLandscape() method 
in a scripting envorinment, perhaps I should provide a 
FCPage:MakeLandscape() and FCPage:MakePortrait() as well, so the script 
code gets cleaner? I can add these methods to the next beta if you want, 
but that beta will probably be a week away or something.

But as I said previously, you can create portrait/landscape page with 
the current Width/Height properties.

> What is the usage of the SwitchTo/Back and SetCurrent in the FCPart
> class?

SwitchTo() and SwitchBack() is an object-oriented way to do editing in a 
different part and then switch back to the previously active part. It's 
OK to switch to the currently active part (see the loop example below).

SwitchTo and SwitchBack must ALWAYS match in pairs in the code, so be 
careful if you use break/goto or similar things. They are typically used 
in a loop, like this:

---
local parts = finale.FCParts()
parts:LoadAll()
for part in each(parts) do
    part.SwichTo()
    -- Do something really important to the part
    part.SwitchBack()
end
---

SetCurrent() is used to re-program a part object to the part currently 
in focus.

Btw, there's a script on the Wiki that uses part editing and page 
editing (called "Assure Page Size Consistency") at:
http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:quickscripts#assure_page_size_consistency

> Is necessary to have a part ViewInDocument  before changing
> settings on a page in the part?

No - and if you browse through the parts, I would advice against using it.

> Also, I discovered that you can click on “Open…” or “Close” (X) in the
> JWLua window with modifications in the Development tab not having been
> saved.  “New…” does give a warning.  So should the others.

Thanks, I'll log this as a bug.


Best regards,

Jari Williamsson





More information about the JWLua mailing list