Indesign CS5 extract pages and rename

Hi
Is it possible via Applescript to extract the pages from an inDesign document as individual pages and rename each individual document to the text in a specific character style.
E.g. A leaflet which has generic elements but is personalised for the destination city, and the city name has a character style applied to it to make it the unique identifier.

(result ‘Chicago.indd’ etc)

Hi there,

Welcome to MacScripter!

Is this any good for starters?

https://forums.adobe.com/thread/945220?start=0&tstart=0

Hi
Thanks for that, it didn’t work, the result said ‘Unsaved documents have no full name." number 90938’
also it didn’t solve the problem of naming the files to the contents of whatever was in a certain paragraph style. Do you think this is possible or is it beyond the capabilities of applescript/indesign?

Hi. It’s possible. I advise that you start by reading Adobe’s Applescript scripting guide for InDesign. I’ve previously posted links to it on the forum. You can also search here for various scripts that obtain paragraph styles and save documents. If you get stuck, post at least a snippet of your code efforts.

This works for me when it comes to splitting the doc in CC 2014.

tell application "Adobe InDesign CC 2014"
	set enable redraw of script preferences to false
	activate
	set dsDoc to active document
	set dsDocProps to properties of document preferences of dsDoc
	set pages per document of dsDocProps to 1
	
	--set dsFilePath to (full name of dsDoc) as text
	set dsFilePath to (full name of dsDoc) as string
	set text item delimiters of AppleScript to "."
	set dsFilePath to text 1 thru text item -2 of dsFilePath
	set text item delimiters of AppleScript to ""
	
	set dsPageCount to (count of pages of dsDoc)
	
	repeat with w from dsPageCount to 1 by -1
		set dsNewDoc to make new document with properties {document preferences:dsDocProps}
		duplicate page w of dsDoc to after page 1 of dsNewDoc
		set active document to dsNewDoc
		delete page 1 of dsNewDoc
		save dsNewDoc to (dsFilePath & "_" & w & ".indd")
		close active document
		delay 1
	end repeat
	close dsDoc saving no
end tell

It should then be fairly straight forward to pick up the specific character style.