Metadata from clipboard

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

Metadata from clipboard

SimonNathan
Hi all,

I want to copy a passage, then to look at the clipboard and determine the name of the instrument that it was copied from. The function "Paste as cue" seems to be able to do this, so I assume the data is stored somewhere - is this something that's accessible in manuscript?

The reference guide doesn't mention anything, and I can't find any other plugins that contain this functionality.

Thanks so much,

Simon

_______________________________________________
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: Metadata from clipboard

Bob Zawalich-3

The simple answer is no.

 

Plugins have no knowledge of that is in the clipboard(s) or where it came from. There is a call

selection.ClipboardContainsData([clipboard Id]) that tells you if there is anything in  either the main clipboard or one of the temporary ones but that is the extent of it.

 

So you are out of luck if what you want is already in the clipboard. if you paste the contents somewhere and try to examine it you are also out of luck because the objects pasted can end up almost anywhere especially if they were copied from a non passage selection.

 

One approach I have used, especially in the downloadable Clipboards plugin, is to use a plugin to do both the copy and the paste. That way you can examine the selection before copying and  possible use metadata extracted when you paste.

 

Be aware, though, that a user can change the clipboard between the copy and paste either directly or via a plugin, so clipboards themselves are not viable places to store your data.

 

As long as you are using Sib 6 or later, you can store data copied into a global sparse array, which will endure for a full Sibelius session even if the plugin terminates. You have to be sure the global sparse array is created before you try to use it.

 

You need to make sure that the score that provided the data is still valid by the time you need to paste (I don’t remember if it has to be still open. Actually there is a PDF file include with the plugin zip file and it says:

 

“The data in these clipboards only lasts for a single Sibelius session. If you copy from a different score, that score must remain open while you are using the data. (This is another place where Ideas has an advantage).”

 

The Sibelius Blog/Scoring Notes has a post that is basically the same as the pdf file

https://www.scoringnotes.com/tips/using-the-clipboards-plug-in-in-sibelius/

 

Feel free to look at the code in Clipboards.plg; I suspect it is somewhat hairy because there were a lot of details involved in deconstructing the selections and storing objects and recreating a passage selection as needed.

 

You are welcome to reuse anything there you might find useful.

 

Good luck,

 

Bob

 

 

From: Plugin-dev [mailto:[hidden email]] On Behalf Of Simon Nathan
Sent: Monday, September 4, 2017 3:06 AM
To: A mailing list for Sibelius plug-in developers <[hidden email]>
Subject: [Plugin-dev] Metadata from clipboard

 

Hi all,

 

I want to copy a passage, then to look at the clipboard and determine the name of the instrument that it was copied from. The function "Paste as cue" seems to be able to do this, so I assume the data is stored somewhere - is this something that's accessible in manuscript?

 

The reference guide doesn't mention anything, and I can't find any other plugins that contain this functionality.

 

Thanks so much,

 

Simon


_______________________________________________
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: Metadata from clipboard

SimonNathan
Thank you SO much Bob for taking the time to answer. Really helpful as always, I'll get on doing it that way!

S

On 4 Sep 2017 20:43, "Bob Zawalich" <[hidden email]> wrote:

The simple answer is no.

 

Plugins have no knowledge of that is in the clipboard(s) or where it came from. There is a call

selection.ClipboardContainsData([clipboard Id]) that tells you if there is anything in  either the main clipboard or one of the temporary ones but that is the extent of it.

 

So you are out of luck if what you want is already in the clipboard. if you paste the contents somewhere and try to examine it you are also out of luck because the objects pasted can end up almost anywhere especially if they were copied from a non passage selection.

 

One approach I have used, especially in the downloadable Clipboards plugin, is to use a plugin to do both the copy and the paste. That way you can examine the selection before copying and  possible use metadata extracted when you paste.

 

Be aware, though, that a user can change the clipboard between the copy and paste either directly or via a plugin, so clipboards themselves are not viable places to store your data.

 

As long as you are using Sib 6 or later, you can store data copied into a global sparse array, which will endure for a full Sibelius session even if the plugin terminates. You have to be sure the global sparse array is created before you try to use it.

 

You need to make sure that the score that provided the data is still valid by the time you need to paste (I don’t remember if it has to be still open. Actually there is a PDF file include with the plugin zip file and it says:

 

“The data in these clipboards only lasts for a single Sibelius session. If you copy from a different score, that score must remain open while you are using the data. (This is another place where Ideas has an advantage).”

 

The Sibelius Blog/Scoring Notes has a post that is basically the same as the pdf file

https://www.scoringnotes.com/tips/using-the-clipboards-plug-in-in-sibelius/

 

Feel free to look at the code in Clipboards.plg; I suspect it is somewhat hairy because there were a lot of details involved in deconstructing the selections and storing objects and recreating a passage selection as needed.

 

You are welcome to reuse anything there you might find useful.

 

Good luck,

 

Bob

 

 

From: Plugin-dev [mailto:[hidden email]] On Behalf Of Simon Nathan
Sent: Monday, September 4, 2017 3:06 AM
To: A mailing list for Sibelius plug-in developers <[hidden email]>
Subject: [Plugin-dev] Metadata from clipboard

 

Hi all,

 

I want to copy a passage, then to look at the clipboard and determine the name of the instrument that it was copied from. The function "Paste as cue" seems to be able to do this, so I assume the data is stored somewhere - is this something that's accessible in manuscript?

 

The reference guide doesn't mention anything, and I can't find any other plugins that contain this functionality.

 

Thanks so much,

 

Simon


_______________________________________________
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