Appending files from a folder. Does the append method exist?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Appending files from a folder. Does the append method exist?

Mackie
My use case is:

Instead of going to File -> Append for each file I have in my folder. I want to write a plugin to automate this.

The plugin will append all .sib files in a folder to the currently open score.

The objects Score, File, Folder do not contain such a method so I am wondering if it exists at all.
Reply | Threaded
Open this post in threaded view
|

Re: Appending files from a folder. Does the append method exist?

Bob Zawalich-3
There is indeed no ManuScript equivalent to File > Append.

Understand that to use Append you need to have the same instruments in the
same order in each score.
If you had that, then you could  do a passage selection of the source score
and then copy it and paste it to the end of the destination score. Repeat as
needed.

Most of the time though the scores do not have the same staves in the same
order.

Trying to match instruments and staves from one score to another, is, in the
general case, impossible. I have attempted doing that a number of times and
always abandoned it. Ossia staves and multiple staves added to instruments
make it particularly difficult to figure out in general.

If you do not need exact matching, you can try mapping the staves from one
score to the other, and then copying and pasting one by one, adding
additional staves to the destination scores as needed (it is tricky to
locate the new staves, though, unless you want them at the top or bottom of
the score, or in the default location for an instrument. In the latter case,
though, at least these days CreateInstrumentReturnStave will return you a
staff object and you can find it reasonably easily).

Good luck if you go this route.

Bob

-----Original Message-----
From: Plugin-dev [mailto:[hidden email]] On Behalf Of
Mackie
Sent: Saturday, July 29, 2017 8:16 AM
To: [hidden email]
Subject: [Plugin-dev] Appending files from a folder. Does the append method
exist?

My use case is:

Instead of going to File -> Append for each file I have in my folder. I want
to write a plugin to automate this.

The plugin will append all .sib files in a folder to the currently open
score.

The objects Score, File, Folder do not contain such a method so I am
wondering if it exists at all.



--
View this message in context:
http://sibelius-manuscript-plug-in-developers.3224780.n2.nabble.com/Appendin
g-files-from-a-folder-Does-the-append-method-exist-tp7573325.html
Sent from the Sibelius ManuScript plug-in developers mailing list archive at
Nabble.com.

_______________________________________________
Plugin-dev mailing list
[hidden email]
http://lists.avid.com/mailman/listinfo/plugin-dev_lists.avid.com


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://lists.avid.com/mailman/listinfo/plugin-dev_lists.avid.com
Reply | Threaded
Open this post in threaded view
|

Re: Appending files from a folder. Does the append method exist?

Mackie
Hi bob,

Thanks alot for the info.

In my situation the scores will ALWAYS have the same staves in the same order.

So you're saying im looking for some sort of copy function? Using the staves object?

Still a little confused. Would be great to be pointed in the right direction
Reply | Threaded
Open this post in threaded view
|

Re: Appending files from a folder. Does the append method exist?

Bob Zawalich-3
So that makes things much easier.

In broad strokes, what you can do is

1. Use SaveCopyAs or SaveAs on the first score to have a copy of the first
score  (or just append directly to the first score if you don't mind losing
it)

Repeat for each score appended:

2. Add 1 bar to the end of the destination score
3. Put a Section End on the last bar before the one you added.
4. Open the source score and do a system selection on the entire score,
i.e., score.Selection.SelectSystemPassage(1, score.SystemStaff.BarCount);
5. Copy the selection (you must use the main clipboard 0 since it is copying
between scores)
6. Select the added bar in the first staff of the destination score. Pasting
a system selection does not work  on a bar in the system staff, so use staff
1.
Paste into the selection. I have often had better results using
PasteToPosition than Paste, and it also means you do not have to actually
change the destination selection.

That should do it, though I have not actually tried these steps so there
will likely be issues along the way.

Good luck!



-----Original Message-----
From: Plugin-dev [mailto:[hidden email]] On Behalf Of
Mackie
Sent: Wednesday, August 2, 2017 2:35 PM
To: [hidden email]
Subject: Re: [Plugin-dev] Appending files from a folder. Does the append
method exist?

Hi bob,

Thanks alot for the info.

In my situation the scores will ALWAYS have the same staves in the same
order.


So you're saying im looking for some sort of copy function? Using the staves
object?

Still a little confused. Would be great to be pointed in the right direction



--
View this message in context:
http://sibelius-manuscript-plug-in-developers.3224780.n2.nabble.com/Appendin
g-files-from-a-folder-Does-the-append-method-exist-tp7573325p7573327.html
Sent from the Sibelius ManuScript plug-in developers mailing list archive at
Nabble.com.

_______________________________________________
Plugin-dev mailing list
[hidden email]
http://lists.avid.com/mailman/listinfo/plugin-dev_lists.avid.com


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://lists.avid.com/mailman/listinfo/plugin-dev_lists.avid.com