Hi there,
I am a newbie in the programming field and wonder if you could help me a bit with this code…
I was just wondering if there is any way to modify the code on this script so that when it runs, it creates a pdf file for each page inside my doc and named only with numbers for example:
0.pdf, 1.pdf, 2.pdf, 3.pdf etc.
This is a script that is meant to run from adobe’s Indesign, here it goes:
tell application “Adobe InDesign CS3”
activate
–set myPageNumPref to page numbering of general preferences
set myDocument to active document
set myFileName to name of myDocument
if (count documents) is equal to 0 then
display dialog “Please open a document” buttons ” OK ” default button 1 with icon caution
return -128
end if
set NumberOfPage to pages per document of document preferences of myDocument
set myFolder to (choose folder with prompt “Please select the folder you want to save your PDF pages in”) as string
–Preset Dialog
set myLabelWidth to 100
set myDialog to make dialog with properties {name:”PDF Presets”}
tell myDialog
tell (make dialog column)
tell (make border panel)
tell (make dialog column)
tell (make dialog row)
tell (make dialog column)
make static text with properties {static label:”Choose Preset:”, min width:myLabelWidth}
end tell
tell (make dialog column)
set myLabelsButtons to make radiobutton group
tell myLabelsButtons
set PresertList to name of every PDF export preset of application “Adobe InDesign CS3”
repeat with myButton in PresertList
make radiobutton control with properties {static label:myButton, checked state:false}
end repeat
end tell
end tell
end tell
end tell
end tell
end tell
end tell
set myResult to show myDialog
if myResult = true then
–don’t know why but, set myPDFPreset to item (selected button of myLabelsButtons) of PresertList, returns the wrong button. The list starts at 0. So:
set x to selected button of myLabelsButtons
set myButtton to x + 1
set myPDFPreset to item myButtton of PresertList
end if
destroy myDialog
tell myDocument
with timeout of 5000 seconds
repeat with x from 1 to NumberOfPage
set mynumbertest to (name of page x of myDocument) as string
set mynumbercnt to count of items in mynumbertest
if mynumbercnt is less than 2 then
set myPageNumber to “0” & (name of page x of myDocument)
else
set myPageNumber to (name of page x of myDocument)
end if
set thePath to (myFolder & myPageNumber & ” ” & myFileName & “.pdf”)
–This is important for setting the page range, the tell has to be to ID
tell application “Adobe InDesign CS3”
set page range of PDF export preferences to (x as string)
export document 1 format PDF type to thePath using PDF export preset myPDFPreset
end tell
end repeat
end timeout
end tell
tell application “Adobe InDesign CS3”
activate
display dialog “Done!”
end tell
end tell?