textframe name

I am trying to make a simple help tool for my self.
I have a document with many textframes on it and trying to count them and also find out what I named them and labeled them…
but code keeps erroring out


tell application "Adobe InDesign CS3"
	activate
	set textframe to count of every text frame
	repeat with x from 1 to textframe
		display dialog ("TextFrame # = " & x & "  Textframe name = " & " Textframe Label = ")
	end repeat
end tell

Coupla things -

page items belong to a document, not the application = so you need to tell Indesign what document you’re talking to. Like so:

set textframe to count of every text frame of document 1

or

tell document 1
	set textframe to count of every text frame 
end tell

But if what you want is the index numbers of the boxes, you’ll need to do this:

tell application "Adobe InDesign CS3"
	activate
	set textframe to every text frame of document 1
	repeat with x in textframe
		display dialog ("TextFrame # = " & id of x & "  Textframe name = " & " Textframe Label = ")
	end repeat
end tell

if you want to get the index of whatever is selected, do this:


tell app "InDesign"
get properties of selection -- or "index of selection" if that's all you want
end tell