Question from Applescript newbie

I’m working with Indesign CS2

I would like to get the id’s of textframes by page.

So far I have

    set myDocument to document 1
tell myDocument
	set theFrames to text frames
	
	repeat with aframe in theFrames
		set FrameID to id of aframe
		
	end repeat
	
	set theFrameList to id of text frames
	return theFrameList as list
	
end tell

but this only gives me a list of the frame ids for the whole document.
How do I get a list indexed with page number?

ie Page 1 {209,180} Page 2 {310,357} Page 3 {208,277}

James

Hi,

try this


tell application "Adobe InDesign CS2"
	set myDocument to document 1
	set theFrameList to {}
	tell myDocument
		repeat with onePage in (get pages)
			if (count text frames) of onePage is {} then
				set end of theFrameList to {}
			else
				set end of theFrameList to id of text frames of onePage
			end if
		end repeat
		return theFrameList
	end tell
end tell

I have CS3 but I think this should still work:

set FinalList to {}
tell application "Adobe InDesign CS3"
	tell active document
		repeat with thisPage from 1 to (count pages)
			tell page thisPage
				set theFrames to text frames
				set theFrameList to (id of text frames) as list
				set beginning of theFrameList to ("Page " & thisPage)
			end tell
			set end of FinalList to theFrameList
		end repeat
	end tell
end tell
FinalList