[JW Lua] Lua Script

Charles O. Lawrence charlesolawrence at bellsouth.net
Thu Sep 19 18:40:41 CEST 2013


Jari,

Your mention of Treble Clef brought up a fact that I was overlooking in my
script to "reset" rests.  I need to check which clef the staff has and set
the displacement accordingly.  I suppose the default displacement is
different for each of the 18 standard clefs.  I will investigate and make
changes appropriately.  This brings up another point about Lua, the absence
of a built-in case or switch statement.  I know it can be implemented, and I
will explore and pick one of the several documented methods.  But wait, what
if one of the 18 clefs is redesigned, is there a way to get info about the
design of clefs?  I don't see a class for such.  I don't see it in FCStaff
either.  Am I missing something?

Charles Lawrence

-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Thursday, September 19, 2013 2:16 AM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Lua Script

On 2013-09-19 05:31, Steve Fiskum wrote:

> I'm looking for a way to uncheck "Float Rest" from the Speedy Edit 
> frame throughout all entries throughout the entire file. Would this be
possible in Lua?

There seems to be some strange Finale (testing on 2012c) bug when I'm just
setting "entry.FloatingRest = false", since I always need to do the changes
TWICE to get the change to stick in Finale. (The changes occur the first
time, but Finale doesn't record them properly.)

So this is a crazy work-around-bug approach that would do the job the first
time:
---
local region = finale.FCMusicRegion()
region:SetFullDocument()
for entry in eachentrysaved(region) do
     if entry:IsRest() then
         if entry.FloatingRest then entry.FloatingRest = false end
     end
end
for entry in eachentrysaved(region) do
     if entry:IsRest() then
         entry.FloatingRest = false
     end
end
---


But here's a more clean, alternative version that works (it works a bit 
different):
---
local region = finale.FCMusicRegion()
region:SetFullDocument()
for entry in eachentrysaved(region) do
     if entry:IsRest() then
         entry:MakeMovableRest()
     end
end
---

Alternatively, you can replace "entry:MakeMovableRest()" with 
"entry:SetRestDisplacement(6)" in the alternative version, which would 
center the movable rest vertically on a treble clef staff.

Also, in the "Plug-in Def" dialog, check "Require Score View" so the 
script will only be runnable when you're in the score.



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