# How can I get the current Pagenumber of a Selected cell in another open Notebook? [closed]

I try to make a Table of Contents of a set of notebooks. Author Tools is crashing regularly when using paginate.

I tried to use something like (inspired by another post here form HEIKE - unfortunately I don't know how to reference other posts.)

book = NotebookOpen[bookUrl];

...

SelectionMove[book, Before, Notebook]

SetOptions[book, ShowPageBreaks -> True];

SelectionMove[book, Next, Cell]

...

CurrentValue[NotebookSelection[book], {"CounterValue", "Chapter"}]

The last one doesn't have the right syntax! Is it possible to use the command for this purpose?

I lurked into Author Tools Pagination.m and Common.m but I am not able to do some reverse engineering.

I use v9, my notebooks are quite normal with Chapter, Section etc. some closed or hidden cells. However there are some page-references within the Notebook.

I am desperately needing to solve this problem. Hope someone can help me. Many thanks.

## closed as off-topic by Kuba♦, user9660, dr.blochwave, MarcoB, RunnyKineMar 7 '16 at 16:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, Community, dr.blochwave, MarcoB, RunnyKine
If this question can be reworded to fit the rules in the help center, please edit the question.

• – user9660 Mar 5 '16 at 7:30
• The syntax is correct. For example i just evaluated: CurrentValue[ NotebookSelection[EvaluationNotebook[]], {"CounterValue", "Section"}] and got the correct number. So the source of your problem would be not having the correct notebook object or alternatively the object is okay but you do not have the Chapter counter set up correctly. – Mike Honeychurch Mar 6 '16 at 1:03
• Thank you Mike for your comment. You are right, this works with EvaluationNotebook[] but not with a "remote" notebook like in my example above. For exampe CurrentValue[book, "NotebookFileName"] works. – Darwin1871 Mar 7 '16 at 11:48
• I don't know why this is of topic. – Darwin1871 Mar 8 '16 at 3:07