get current page in plugin

Sibelius beginners can discuss all things Sibelius here ("how do I...?").
bliako
Posts: 1
Joined: Fri Jun 14, 2019 9:54 am
Sibelius Version: 7.5
Operating System: Mac

get current page in plugin

Post by 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.");
		ExitPlugin();
	}
	found = 0;
	for each Bar b in selection {
		currentPage = b.GetPageNumber();
               // this shows curren t page as blank!
              Sibelius.MessageBox(currentPage);
		found = 1;
	}
Sibelius.MessageBox(currentPage);
	if( found = 0 ){
		Sibelius.MessageBox("Selection is empty");
		ExitPlugin();
	}
}
Can someone help?

Re: get current page in plugin

by Sponsor

Forum Sponsor
 

Post Reply