Hi,
I wrote a simple script that extracts the text of InCopy stories in an InDesign doc if some criteria are met. I would like to extract the text in order of appearance, or at least page order, but I cannot find a way to match link items to stories. Any suggestions?
global myLinks
global uniqueInCopyStories
global myFinalReport
global wrongText
global uniqueInCopyStories
set uniqueInCopyStories to {}
set wrongText to "BA"
set theDoc to choose file without multiple selections allowed
set theDocInfo to info for theDoc
set theDocName to name of theDocInfo
set theDocName to characters 1 thru -6 of theDocName as text
set theDocName to theDocName & return
set myFinalReport to ""
my processFiles(theDoc)
set mylist to items 1 thru -1 of uniqueInCopyStories
set mynewlist to {}
repeat with i from 1 to (count of mylist)
set myitem to item i of mylist as text
set end of mynewlist to myitem
end repeat
set mystring to mynewlist as string
--return mystring
my processWordDoc(theDocName, mystring)
on processFiles(theDoc)
tell application "Adobe InDesign CS3"
activate
open theDoc
tell active document
set myLinks to every link whose link type is "InCopyInterchange" as text
repeat with aLink in myLinks
set mystorytitle to story title of parent of aLink
set myText to characters 1 thru 2 of mystorytitle as text
if myText is not equal to wrongText then
set myStory to contents of parent of aLink
copy mystorytitle & myStory to end of uniqueInCopyStories
end if
end repeat
end tell
end tell
end processFiles
on processWordDoc(theDocName, mystring)
tell application "Microsoft Word"
activate
set newDoc to make new document
copy theDocName & mystring to content of text object of newDoc
end tell
end processWordDoc