Highlighted

Need to add consecutive number field to a master page

New Here ,
Mar 27, 2020

Copy link to clipboard

Copied

Sheet Numbers.png

I know how to use the page numbering, but that function is already being used to generate non-contiguous drawing ID numbers by section, which are needed for my index. What I need is an additional (scripted?) field to add consecutive numbering to my pages. Can anyone point me to a method of doing this, so if I remove pages from the document, the field will automatically renumber?

 

Thanks!

Topics

Scripting

Views

527

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Need to add consecutive number field to a master page

New Here ,
Mar 27, 2020

Copy link to clipboard

Copied

Sheet Numbers.png

I know how to use the page numbering, but that function is already being used to generate non-contiguous drawing ID numbers by section, which are needed for my index. What I need is an additional (scripted?) field to add consecutive numbering to my pages. Can anyone point me to a method of doing this, so if I remove pages from the document, the field will automatically renumber?

 

Thanks!

Topics

Scripting

Views

528

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 27, 2020 0
Adobe Community Professional ,
Mar 27, 2020

Copy link to clipboard

Copied

Can you clarify the page number: is it just the "2" or the entire number? For example, is the next page "343" or "244"? (Not sure if the number points the entire figure or just the first number.)

 

How to the sheet numbers increment from page to page?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2020 0
New Here ,
Mar 28, 2020

Copy link to clipboard

Copied

The document is broken into sections, with each section allocated a set number of pages as needed: SP-000 to 050, SP-100-299, SP-300-320, etc.  So, "General Information" sheets are 000-050, "Location Maps" are 100-299, and so on. Typically, there are fewer actual sheets than the page range allocated, to allow later additions. There are currently 184 actual pages in the document. In the example, the next sheet is SP-244.

 

Each section uses separate pagination, and that sheet number is linked back to the TOC, along with a sheet title.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 28, 2020

Copy link to clipboard

Copied

Sorry for my mental density--not being as clever as most, I'm one of those "I have to see it in front of me to understand it" type of persons. 

 

If I understand it correctly, your book is set up like this:

  • Section 1: SP-001-029 could take up pages 1-29. (I'm skipping page 000 for this example.)
  • Section 2: SP-100-131 could take up pages 30-60.
  • Secton 3: SP-300-350 could take up pages 61-110. 
  • And so on...

Is that how it works? (I'm not worrying about even/odd pages for this example.)

 

It reads as if you have the page numbering under control. 

What about using a simple auto-fill spreadsheet number for the sheet numbering. It can be a small box that is linked from page to page; you can even use auto-flow if you set it up correctly. You can use named regions or separate worksheets in Excel. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
New Here ,
Mar 28, 2020

Copy link to clipboard

Copied

Yes, you have it. It's one of those working docs that constantly have pages added to and deleted from the sections, and so the TOC index needs to be updated with each change. There are no facing pages, just individual architectural-sized sheets.

 

In addition, I need to dynamically track the actual page count. I want a text box that will automatically renumber the whole document if a page is deleted from the middle of the set, as if I was using page numbering without sections. That's the twist that I'm struggling to solve.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 28, 2020

Copy link to clipboard

Copied

Again, to clarify... (Sorry if some of this is really basic info--I just want to make sure we are on the same "page", so to speak.)

Using this as an example: Section 2: SP-100-131 could take up pages 30-60.

 

Your page numbers will dynamically update is using the Current Page Number marker--so if you delete page 40, pages 41-60 will renumber appropriately to 40-59. You can have a total page count per document using a Variable to get page 30 out of 60, page 31 out of 60, etc. 

 

For the SP numbering, as I understand it, you want the numbering to stay continous from page to page, so it would be SP-100-131. If you deleted page 40, you want the numbering to "shuffle" so it becomes SP-100-130, with no missing number in the middle. Is that correct?

 

If so, you might be able to do this easier with a numbered list paragraph style and just manually set the starting number.

If not and you want to skip the numbering, using a number file (created in Excel) should take care of that as the numbering would auto-flow--but you would have to break the flow using one of the supplied scripts. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
New Here ,
Mar 28, 2020

Copy link to clipboard

Copied

Exactly right.

So, can I set up the excel linked text box on the master page, or do I need to have a text box on every page linked to flow the text? If so, will deleting a page in the middle break the flow?

 

I will check out numbered list, and see if that works.

 

Thanks for the help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 28, 2020

Copy link to clipboard

Copied

Sorry--I edited my answer while you were responding to the original. My bad. 

If  you want the numbers to shuffle, you can use a numbered list. The text boxes don't have to be linked since the default settings will link across stories, but you will probably want to turn off continue from previous documents. 

2020-03-28_14-03-01.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 28, 2020

Copy link to clipboard

Copied

Here is a sample that does what I think you are looking for:

https://adobe.ly/2wAfu8s

 

Note: when using numbered lists, you need at least a space in the text box. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 28, 2020

Copy link to clipboard

Copied

Not sure if it can be done through text variables, but it could be done through script. Set up a paragraph style for the SP-243 line. Let's call it "PageNum". Then here's a script that you could run: 

 

 

 

app.findGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.appliedParagraphStyle = "PageNum";
var myFinds = app.findGrep();

for (var i = 0; i < myFinds.length; i++) {
   myFinds[i].contents = "SP-" + myFinds[i].parentTextFrames[0].parentPage.documentOffset;
}

app.findGrepPreferences = NothingEnum.NOTHING;

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
New Here ,
Mar 28, 2020

Copy link to clipboard

Copied

Thanks! I haven't tried using GREP scripting before, but this looks like the time to work out how.

 

If I am understanding this:

myFinds[i].contents = "SP-" + myFinds[i].parentTextFrames[0].parentPage.

it will add the text "SP-", and then a consecutive number (myFinds [i])? Does this need to be formatted differently if I don't need the text, but just the number? Final format should be ### of (Total Pages).

 

Do I put a text box on the master sheet and add a placeholder for the "PageNum"?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2020 0
Adobe Community Professional ,
Mar 29, 2020

Copy link to clipboard

Copied

Yes, the way I wrote it, the script would replace with "SP-" plus the page number (section agnostic) that the find[i] is found on. Yes, you would want to add a frame with the paragraph styled with PageNum, and some kind of standnig text, to your master page.

 

app.findGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.appliedParagraphStyle = "PageNum";
var myFinds = app.findGrep();

for (var i = 0; i < myFinds.length; i++) {
   myFinds[i].contents = myFinds[i].parentTextFrames[0].parentPage.documentOffset;
}

app.findGrepPreferences = NothingEnum.NOTHING;

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 29, 2020 0