[JW Lua] Copy/Paste With FCMusicRegion()
Martin Marris
mmarris at notecraft.com
Mon Dec 14 21:32:14 CET 2020
I was afraid of that. For that time being I will hammer away at trying to get a region approach to work.
>>I don't know what you are planning to do<<
I am working on a large customer project. The source files are condensed conductor scores (at least 600 scores, and potentially far more in the coming months, maybe even in the thousands) with approximately nine instrument staves, with multiple instrument on each staff. I am “exploding” these scores so that each instrument has its own staff. Of course there are existing released plugins (TGTools, JW) that can do that, but the volume of work is such that a programmatic approach using JW Lua makes sense. I know this because I processed the first 300 scores using the “manual,” “let’s run these plugins” approach and, while effective, these are very repetitive and identical operations for each file. I am fortunate in that the source files are homogeneous in structure.
In theory this should be a piece of cake, so I was surprised at the quirks in copy/paste in JW Lua.
For background: I am an experienced Sibelius ManuScript programmer. Copying the contents of one staff to another (programmatically, not via user selection) would be a piece of cake in ManuScript. So I find this Finale issue a bit puzzling! (I’ve also been using Finale for 30 years.)
Thanks, as ever.
Martin
From: JWLua <jwlua-bounces at jwmusic.nu> On Behalf Of Robert Patterson
Sent: Monday, December 14, 2020 20:11
To: The JW Lua script plug-in. <jwlua at jwmusic.nu>
Subject: Re: [JW Lua] Copy/Paste With FCMusicRegion()
I don't know what you are planning to do, but transferring the notes individually is possible. It is also potentially quite complicated. In addition to notes, you have to copy all the other stuff in the Mass Edit filter window. (Or as much of it as you need.) If you go that route, you will know Finale programming inside and out by the end of the project.
On Mon, Dec 14, 2020 at 2:07 PM Martin Marris <mmarris at notecraft.com <mailto:mmarris at notecraft.com> > wrote:
Thanks Robert. So close, yet so far.
Will investigate.
Meanwhile: I assume the other way to copy/paste is to bypass the Region approach altogether and to use note cells instead. I have messed around with several alternatives but got nowhere, but what do I know?
Martin
From: JWLua <jwlua-bounces at jwmusic.nu <mailto:jwlua-bounces at jwmusic.nu> > On Behalf Of Robert Patterson
Sent: Monday, December 14, 2020 20:00
To: The JW Lua script plug-in. <jwlua at jwmusic.nu <mailto:jwlua at jwmusic.nu> >
Subject: Re: [JW Lua] Copy/Paste With FCMusicRegion()
Unfortunately, this may be a bug in either JW Lua or Finale. It may also be limited to Windows Finale. I have no personal experience with it, because I have never used the underlying API calls in the PDK. It is unfortunate that the PDK Framework does not provide a way to call the Copy/Paste menu items in the Edit menu. This is what I would do if programming directly to the PDK. (I don't trust the Copy/Paste APIs because I don't think they get much use, and they use clip files.)
You could try creating the directory it wants to write the clip files in. Maybe that would help. IDK.
On Mon, Dec 14, 2020 at 1:47 PM Martin Marris <mmarris at notecraft.com <mailto:mmarris at notecraft.com> > wrote:
Hi Robert,
Do you mean like this? It’s not working, I get a variant of the same message box error notification:
local musicregion = finale.FCMusicRegion()
musicregion.StartMeasure = 1
musicregion.EndMeasure = 2
musicregion:SetInDocument()
musicregion:CopyMusic()
musicregion.StartMeasure = 3
musicregion.EndMeasure = 4
musicregion:SetInDocument()
musicregion:PasteMusic()
musicregion:ReleaseMusic()
Martin
From: JWLua <jwlua-bounces at jwmusic.nu <mailto:jwlua-bounces at jwmusic.nu> > On Behalf Of Robert Patterson
Sent: Monday, December 14, 2020 19:36
To: The JW Lua script plug-in. <jwlua at jwmusic.nu <mailto:jwlua at jwmusic.nu> >
Subject: Re: [JW Lua] Copy/Paste With FCMusicRegion()
Try calling musicregion:SetInDocument() after setting the start and end measures (both times).
On Mon, Dec 14, 2020 at 1:18 PM Martin Marris <mmarris at notecraft.com <mailto:mmarris at notecraft.com> > wrote:
I am trying to create a Region programmatically (rather than through user interaction).
Then, copy/paste between regions.
But if I run the following simple script:
local musicregion = finale.FCMusicRegion()
musicregion.StartMeasure = 1
musicregion.EndMeasure = 2
musicregion:CopyMusic()
musicregion.StartMeasure = 3
musicregion.EndMeasure = 4
musicregion:PasteMusic()
musicregion:ReleaseMusic()
I get this result:
Message box: Title “Finale” and text “Cannot read library c:\users\myusername\AppDate\LocalLow\Fin33B.tmp”.
Why?
Martin
_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20201214/cc12dc7b/attachment.htm>
More information about the JWLua
mailing list