How can I return the actual page names (C1)
I'm not clear what you are asking for. Do you want to return the page names to just numbers? In that case, you would remove the prefix from the Section and Numbering Options.
I am trying to export each page as a separate PDF with the page name included in the filename.
You could a.) export one pdf and break it up into 8 pages (and rename them) in Acrobat or b.) use a script: Exporting individual pages to PDF / Indesign
Thanks Barb. You got me on the right track. I am scripting this to try to return the page name and not just the page number. Your screenshot helped me out - I totally forgot about the "Include Prefix when Numbering Pages". Now that it is checked when I return the Page.Name it is showing "C1" which is what I was trying to get.
Awesome! Glad you are back on track.
as I read the title of the thread I was wondering what exactly is meant by "return" in "return name of page".
In scripting speak "returning something" has a different meaning than "return to some former state".
When a programmer asks what is "returned" usually it is meant, that a function would give something back. A result.
In this case the OP wanted to read out the full name of a page, that can be a single string of characters like "1". That's not a number. It is a name.
"Include Prefix when numbering pages" makes a difference here.
Not in the UI when the page names are visible as "C1" in the Pages Panel, but by scripting when a page is asked for its name:
[ ]"Include Prefix when numbering pages" => page.name is "1"
[x]"Include Prefix when numbering pages" => page.name is "C1"
page.documentOffset => 0 * ( if the page is the first page in the document; and here a number is returned )
// EDIT: With ExtendScript numbering begins with 0 , VB-Script numbering can begin with 1 .