Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 9th, 2025, 9:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Page Number
PostPosted: April 27th, 2005, 6:59 pm 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Is there any way to insert the current page number and/or the total number of pages of a certain chapter onto a page - via a variable or a script function ?

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


For this message Klaus Rosmanitz has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 28th, 2005, 1:01 am 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

The following code will store the name of the current page in string format (i.e; Page 1) to a variable named pagename:

Code:
pagename = this.GetParent().GetName()


The following code will store the number of pages in the current chapter to a variable named pagecount:

Code:
pagecount = this.GetParent().GetNumberChildren()


I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Last edited by Robin Garrett on April 28th, 2005, 1:33 pm, edited 1 time in total.

Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 28th, 2005, 1:07 pm 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Thanks Robin !

I can use the second part to get the number of pages in a chapter but is there anyway I can get the position of the page I am on into a variable, like e.g. page 4 of 15 :?:

I looked up the script help but there is no function that does this .

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


For this message Klaus Rosmanitz has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 28th, 2005, 1:39 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi Klaus,

Thank you for your reply.

Please try the following syntax:

Code:
pagenum = GetPageNumber()
pagecount = this.GetParent().GetNumberChildren()
display = "You are on Page " + pagenum + " of " + pagecount


Now simply create a text object on the page and insert the display variable (you will need to create this as a publication variable).

The attached publication demonstrates the result.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 29th, 2005, 5:41 am 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Thank's Robin for your quick support - as always :D

Please correct me if I'm wrong but the GetPageNumber() function applies to all the pages in a publication, so if I would want the current page number of a chapter I'd have to deduct the number of previous pages and place this somewhere into a variable - or is there an easier way I'm not thinking of ??

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


For this message Klaus Rosmanitz has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2005, 12:07 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Klaus..
If you making use of master pages, to ensure that the page counts are correct, you would need to create a chapter that will hold these and any other pages that will not be part of the publication.
At publish of-course, the chapter will not be accessed via goto page/forward etc etc..

This applies to code
var_Pagecount = this.GetParent().GetNumberChildren()
where master page(s) will be counted in as children.


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2005, 12:29 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi Klaus,

The following syntax should resolve the problem:

Code:
pagecount = this.GetParent().GetNumberChildren()
currentpage = this
for (n=0;n<pagecount;n++) {
   name = this.GetParent().GetChild(n)
   if (name == currentpage) {
      pagenum = n+1
   }
   n++
}
display = "You are on Page " + pagenum + " of " + pagecount


Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 1st, 2005, 4:57 pm 
Offline

Joined: November 22nd, 2004, 7:26 pm
Posts: 119
Location: Austria
Thanks for the code. I'll give it a try :D

_________________
Klaus Rosmanitz
Austria


________
XP Home , Opus Pro 5.5


For this message Klaus Rosmanitz has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 71 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group