Sibelius Forum Store | Buy Sheet Music

get current page in plugin

Sibelius beginners can discuss all things Sibelius here ("how do I...?").

get current page in plugin

Postby bliako » Thu Jul 11, 2019 9:36 pm

Hi there,
I am looking for help on writing plugins.

I have quite a lot of experience in other programming languages but this is my first Sibelius plugin.

My aim is to export only one page, let's say the page where user has selected a bar or a note, to PNG.

But for more than 1 pages, SaveAs() outputs "0001.png", "0002.png" etc. Which is fine as long as I can also get which page the user has in mind (by selecting a bar or a note to signify that).

So, is there a way to get the page a selected bar is in?
I tried:

Code: Select all
score = Sibelius.ActiveScore;
if( score.StaffCount=0 ){ Sibelius.MessageBox("no staff!"); ExitPlugin(); }
astaff = score.NthStaff(1);
if( astaff.BarCount=0 ){ Sibelius.MessageBox("no bar!"); ExitPlugin(); }
abar = astaff.NthBar(1);
pageCount = score.PageCount;
selection = score.Selection;
currentPage = 1;
if( pageCount > 1 ){
   if( not(selection.IsPassage) ){
      Sibelius.MessageBox("There are "&pageCount&" pages, you must select a bar in the page you want.");
   found = 0;
   for each Bar b in selection {
      currentPage = b.GetPageNumber();
               // this shows curren t page as blank!
      found = 1;
   if( found = 0 ){
      Sibelius.MessageBox("Selection is empty");

Can someone help?
Posts: 1
Joined: Fri Jun 14, 2019 9:54 am

Re: get current page in plugin

by Sponsor

Forum Sponsor

Similar topics

Return to Beginners

Who is online

Users browsing this forum: No registered users and 7 guests

Music Engravers and Music Copyists
   Finale - Sibelius - Cakewalk - Archives - Sibelius Books - Links - Contact

Copyright © 1994 - 2019 by C.M. Press, LLC