[JW Lua] Page/Part questions

Charles O. Lawrence charlesolawrence at bellsouth.net
Mon Sep 23 01:10:44 CEST 2013


Jari,

I don't think it is necessary to kludge something up if it is not supported
in the data.  There are radio buttons on the appropriate dialogs for
portrait/landscape.  I just assumed this was a page property, but of course
it can be determined from width/height data.  I presume, if you implement
the two methods you mention, that all they would do is swap the width and
height parameters if required.

I now see that I can put changes to a part within the SwitchTo/From
"wrapper" as you show in the sample instead of using ViewInDocument without
using SwitchTo/From.

You said " SetCurrent() is used to re-program a part object to the part
currently in focus."  Could you elaborate?  Sorry, I still don't get it.

Thanks,
Charles Lawrence



-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Sunday, September 22, 2013 3:40 PM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Page/Part questions

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


_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list