My end goal is to determine if an InDesign document contains any threaded or linked text frames, and if so, alert the operator.
I initially thought I could easily accomplish this by comparing the count of text frames to the count of stories. For example, if the count of text frames is greater than the count of stories, the operator would receive an alert. However, I’ve found that text frames that are “pasted into” other frames are not detected as text frames with a simple call, such as:
tell application id "com.adobe.InDesign"
set textFrameCount to count of text frames of document 1
set storyCount to count of stories of document 1
display dialog textFrameCount
display dialog storyCount
end tell
However, after some more trial and error, I believe the logic used in the script below is rather sound:
set myIDList to {}
tell application id "com.adobe.InDesign"
set api to all page items of document 1
set textFrameCount to 0
set storyCount to 0
repeat with x in api
if class of x is text frame then
--do something to the rectangles
set textFrameCount to textFrameCount + 1
set myID to id of parent story of x
--display dialog myID
if myID is not in myIDList then
set end of myIDList to myID
set storyCount to storyCount + 1
end if
end if
end repeat
end tell
--display dialog textFrameCount
---display dialog storyCount
if textFrameCount is greater than storyCount then
display dialog "There are more text frames than there are stories, so most likely there are some threaded text frames."
end if
Thank you in advance!
-Jeff