Choose Pages to PDF (Indesign)

Is there a way to show a list of the pages in Indesign, so that I can choose which ones I need to convert to single page PDFs. This is what I have so far but I get an error saying that it can’t find pages in the doc.


set issue_number to text returned of (display dialog "Enter the Issue Number" default answer "00") as string

set region_list to {"California COMMON", "California LA", "California OC", "California SD", "California BigBook", "Chicago", "Colorado", "Texas COMMON", "Texas Austin", "Texas Dallas", "Texas Houston", "Texas BigBook"}
set ZIP_list to {"CAL_COM", "LA", "OC", "SD", "CAL", "CH", "CO", "TEX_COM", "AUS", "DAL", "HOU", "TEX"}

set region_code to choose from list region_list with prompt "Choose a Region:"
tell result
	if it is false then return
	set region_code to item 1 of it
end tell

if region_code is false then return
repeat with i from 1 to count region_list
	if item i of region_list is region_code then exit repeat
end repeat
set new_code to item i of ZIP_list

set folder_path to (choose folder with prompt "Select folder to Save PDF files") as string

tell application "Adobe InDesign CS3"
	activate
	set doc_name to active document
	set doc_pages to pages of doc_name
	
	set thePages to every page of doc_name
	set PagesToPrint to (choose from list thePages with prompt "Choose Pages to PDF:" with multiple selections allowed)
	repeat with anItem in PagesToPrint
		set page_number to name of anItem as string
		
		count characters of page_number
		if length of page_number is 1 then
			set new_number to text -3 thru -1 of ("00" & page_number)
		end if
		if length of page_number is 2 then
			set new_number to text -3 thru -1 of ("0" & page_number)
		end if
		if length of page_number is 3 then
			set new_number to page_number
		end if
		
		repeat with anItem in doc_pages
			set new_number to text -3 thru -1 of ("00" & name of anItem)
			set PDF_name to folder_path & region_code & "_LX" & issue_number & "_" & new_number & ".pdf"
			set page range of PDF export preferences to page_number
			
			--set page range of PDF export preferences to "Sec1:" & page_number
			
			tell doc_name
				export format PDF type to PDF_name using "Prinergy Pages" without showing options
			end tell
		end repeat
	end repeat
end tell

beep
display dialog "Your PDFs are Done" buttons {"Done"} default button 1

Thanks Tim

Hi,

the direct parameter of choose from list must be something, which can be displayed.
A list of strings can be displayed, but not a list of elements like pages.

You can use this for example


.
set thePages to name of every page of doc_name
set PagesToPrint to (choose from list thePages with prompt "Choose Pages to PDF:" with multiple selections allowed)
.

Btw: I don’t understand the two nested repeat loops in the Indesign part, which do actually the same

Thanks StefanK,

After a little work I got it to work,
And thanks for the heads up about the repeat, just kept over looking it.
Focusing too much on the other part.

Tim