Finale SmartMusic
  Home | Log In | Register | Search | Help
   
MakeMusic Forum > Public Forums > Plug-In Development - FORUM HAS MOVED! > JW Lua questions  Forum Quick Jump
 
You cannot post new topics in this forum. You cannot reply to topics in this forum. Printable Version
[ << Previous Thread | Next Thread >> | Show Newest Post First ]

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/26/2015 5:27 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
I'm writing my first JW Lua script, to put double barlines at key- and time-signature changes.

allmeasures = finale.FCMeasures()
allmeasures:LoadAll()
lastmeasure = finale.FCMeasure()
for measure in each(allmeasures) do
    if measure.ItemNo > 1 then
        if not measure.TimeSignature:IsIdentical(lastmeasure.TimeSignature)
        or not measure.KeySignature:IsIdentical(lastmeasure.KeySignature)
        then
            lastmeasure.Barline = finale.BARLINE_DOUBLE
            lastmeasure:Save()
        end
    end
    lastmeasure = measure
end


It's getting the error

[string "allmeasures = finale.FCMeasures() ..."]:6: attempt to index field 'TimeSignature' (a userdata value)

What am I doing wrong?


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Post Edited (Motet) : 3/26/2015 5:59:32 PM (GMT-5)

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/26/2015 6:08 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
If I try this instead

if not measure.GetTimeSignature():IsIdentical(lastmeasure.TimeSignature)


I get "[string "allmeasures = finale.FCMeasures() ..."]:6: bad argument #1 to 'GetTimeSignature' (FCMeasure expected, got table)"

Does "each()" produce a table rather than a FCMeasure?


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Back to Top

Jari Williamsson
Registered Member

Click to send Jari Williamsson email.Click to visit Jari Williamsson's website.Send a Private Message to Jari WilliamssonAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 1998
Total Posts : 3246
 
   Posted 3/27/2015 3:31 AM (GMT -6)    Quote This PostAlert An Admin About This Post.
Your script was almost correct. each() indeed produces FCMeasure objects in your script.

TimeSignature is a property and should be preceeded with a '.'

GetTimeSignature() and IsIdentical() are method calls and should be preceeded with a ':'

This version should work:

local allmeasures = finale.FCMeasures()
allmeasures:LoadAll()
lastmeasure = finale.FCMeasure()
for measure in each(allmeasures) do
    if measure.ItemNo > 1 then
        if not measure.TimeSignature:IsIdentical(lastmeasure.TimeSignature)
        or not measure.KeySignature:IsIdentical(lastmeasure.KeySignature)
        then
            lastmeasure.Barline = finale.BARLINE_DOUBLE
            lastmeasure:Save()
        end
    end
    lastmeasure = measure
end


Jari Williamsson

Windows XP, Pentium 4
2.40 GHz, 4 GB RAM

www.finaletips.nu - The Finale Productivity Tips site

Post Edited (Jari Williamsson) : 3/27/2015 3:34:36 AM (GMT-5)

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/27/2015 10:55 AM (GMT -6)    Quote This PostAlert An Admin About This Post.
Except for the "local", that's what I had in my original posting, and I still get

[string "local allmeasures = finale.FCMeasures() ..."]:6: attempt to index field 'TimeSignature' (a userdata value).

I suspect I don't have the latest versions of everything. Will investigate.


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Post Edited (Motet) : 3/27/2015 11:00:49 AM (GMT-5)

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/27/2015 12:00 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
D-oh! I just needed the latest JW Lua. Since JW Plug-in Manager doesn't manage it I had never updated it. Thanks for your help and sorry for the false alarm. I am excited to be learning this and predict great things to be gained.

Is there access to the displayed time signature, by the way? Since I rarely use that, it's no big deal if not, but ideally these double barlines are based on what the player sees, not the underlying Finale time signatures. Conceivably, one could have a split measure or something.


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Post Edited (Motet) : 3/27/2015 12:04:04 PM (GMT-5)

Back to Top

Jari Williamsson
Registered Member

Click to send Jari Williamsson email.Click to visit Jari Williamsson's website.Send a Private Message to Jari WilliamssonAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 1998
Total Posts : 3246
 
   Posted 3/27/2015 5:48 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
Motet said...
Is there access to the displayed time signature, by the way? Since I rarely use that, it's no big deal if not, but ideally these double barlines are based on what the player sees, not the underlying Finale time signatures. Conceivably, one could have a split measure or something.


These FCMeasure properties should work:
FCMeasure.UseTimeSigForDisplay (boolean)
FCMeasure.TimeSignatureForDisplay (FCTimeSignature object)


Jari Williamsson

Windows XP, Pentium 4
2.40 GHz, 4 GB RAM

www.finaletips.nu - The Finale Productivity Tips site

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/27/2015 8:07 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
Thanks, Jari!


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/29/2015 4:33 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
Jari,

Looks like FCNote:GetString() doesn't observe "simplify key" in the transposition. For example, in the concert key of F# major, the Bb Clarinet's key signature would be Ab major, and GetString() returns "E#" for a written F. Any work-around?

(If you would prefer I take my questions to the mailing list, I'm happy to do so.)


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Back to Top

Charles Lawrence
Registered Member



Click to send Charles Lawrence email.Personal Homepage Not AvailableSend a Private Message to Charles LawrenceAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2009
Total Posts : 3638
 
   Posted 3/30/2015 10:05 AM (GMT -6)    Quote This PostAlert An Admin About This Post.
Motet said...

(If you would prefer I take my questions to the mailing list, I'm happy to do so.)

That would be better, as it is the de facto clearing house for all things JW Lua related, not this forum.  Besides, there are list members who do not look at this forum.


"Anything is possible if you don't know what you are talking about!"

 

Intel(R) Core(TM) i7-5930K CPU with 6 dual core processors @ 3.50 GHz (12 threads)

Realtek High Definition on board audio
NVIDIA GeForce GTX 980 GPU with 4GB ram

512 GB SSD

Four 4TB and one 1TB internal SATA HD's
Microsoft Windows 8.1 Professional with Media Center x64 Edition, (06.03.9600.00)
Finale versions: 2011b.r2, 2012c.r13, 2014d.v5030

GPO4.02

 

Cakewalk SONAR X3

 

"There is a world of difference between a person who has a big problem and a person who makes a problem big." – John Maxwell

Back to Top

Motet
Isorhythmic



Email Address Not AvailablePersonal Homepage Not AvailableSend a Private Message to MotetAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2002
Total Posts : 12849
 
   Posted 3/30/2015 12:17 PM (GMT -6)    Quote This PostAlert An Admin About This Post.
I have done so.


Finale 2011b, 2005, TGTools
Windows 7, MIDI input
Finale Transposition Chart

Back to Top
You cannot post new topics in this forum. You cannot reply to topics in this forum. Printable Version
   
Forum Information
Currently it is Tuesday, December 19, 2023 6:03 PM (GMT -6)
There are a total of 403,820 posts in 58,165 threads.
In the last 3 days there were 0 new threads and 0 reply posts. View Active Threads