This content has been marked as final. Show 5 replies
Is it possible you have section numbering and there is no page named "1"?<br />Try setting to absolute numbering and see if it works.<br /><br />-- <br />Shane Stanley <firstname.lastname@example.org>
I think when you set page range in the loop you should use “name” property of the page object:
set page range of PDF export preferences to name of page p of mydoc
See “Exporting Individual Pages to PDF example” on page 39 in InDesignCS3_ScriptingGuide_AS.pdf – it’s very similar to what you are trying to do.
You can also download the free Page Exporter Utility here: http://indesignsecrets.com/page-exporter-utility-peu-5-script-updated-for-cs3.php.
Hi Shane & Kasyan,
Sorry for the late answer, I have been busy here and in fact I even had not the occasion to try your advices until now.
Unfortunalety, I am still stuck. Using the page name has no effect and the script still crashes.
I ain't used any page section so it's no a way too. I am not sure I understood wel what you suggests with absolute numbering but I am digging that way and see if I can find anything.
I will have a look on the page exporter tool but whatever the way, I need to achieve by my own. Indeed I want to produce a mini application form my code for any of my colleagues to use it.
I will find, I will get it !
Thanks a lot for trying to help.
Here is a little altered version of the ExportEachPageAsPDF script from the examples provided by Adobe. I assume, from the script you posted, that you want exported files to be named in the following way: toto + _ + page number + .pdf. But in my judgement, it would be more reasonable to use the name of active document without extension instead of "toto".
Why are you trying to reinvent the wheel? Isn't it better to take a ready-made script and remake it to your needs?
tell application "Adobe InDesign CS3"
if (count documents) is not equal to 0 then
display dialog "Please open a document and try again."
set myFolder to choose folder with prompt "Choose a Folder"
--Get the folder name (it'll be returned as a Unicode string)
set myFolder to myFolder as string
--Unofficial technique for changing Unicode folder name to plain text string.
set myFolder to "class ktxt" of (myFolder as record)
if myFolder is not equal to "" then
tell application "Adobe InDesign CS3"
set myDocument to active document
--set myDocumentName to name of myDocument
repeat with myCounter from 1 to (count pages in myDocument)
set myPageName to name of page myCounter of myDocument
set page range of PDF export preferences to name of page myCounter of myDocument
--Generate a file path from the folder name, the base document name, and the page name.
--Replace any colons in the page name (e.g., "Sec1:1") so that they don't cause
--problems with file naming.
set myPageName to my myReplace(myPageName, ":", "_")
set myFilePath to myFolder & "toto" & "_" & myPageName & ".pdf"
--The export command will fail if you provide the file path
--as Unicode text--that's why we had to convert the folder name
--to plain text.
export format PDF type to myFilePath using "[PDF/X-1a:2001]"
on myReplace(myString, myFindString, myChangeString)
set AppleScript's text item delimiters to myFindString
set myTextList to every text item of (myString as text)
set AppleScript's text item delimiters to myChangeString
set myString to myTextList as string
set AppleScript's text item delimiters to ""
SOLVED at last !
b Thanks for all your help
You are right, trying to reinvent the wheel is one of my worst defaults.
Anyway, I finally succeed. It was dumb as usually in this cases.
In fact, I just forgot to tell active document to export...So I guess the script failed cause of a lack of reference.
Toto is for me a generic name for debugging purposes. It's clear that in the end, the final PDF name has to to be the name of the actual document.
As I begin scripting AS, I progress very shortly from one step to another.
Thanks again for worry.