Hi,
I’ve had a script working fine. I’m in Yosemite and it worked fine in that OS, but there have been updates. I have yet to upgrade the OS to a new version, so I can work with InDesign CS6
This script was working up until a month ago:
global WordDocName
global wrongText
global myStories
--set uniqueInCopyStories to {}
--set wrongText to "BASE"
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 WordDocName to theDocName
set theDocName to theDocName & return
set myStories to {}
my processFiles(theDoc)
set mylist to items 1 thru -1 of myStories
set firstList to mylist
set secondList to RemoveDuplicates(firstList)
--secondList --> {1, 2, 3, 4}
set mynewlist to {}
repeat with i from 1 to (count of secondList)
set myitem to item i of secondList as text
set end of mynewlist to myitem
end repeat
set mystring to mynewlist as string
--return mystring
my processWordDoc(theDocName, mystring, WordDocName)
on processFiles(theDoc)
tell application "Adobe InDesign CS6"
activate
open theDoc
tell theDoc
set myPages to every page
repeat with i from 1 to count of myPages
tell item i of myPages
set myTextFrames to (every text frame of item i of myPages)
repeat with aTextFrame in myTextFrames
if item link of parent story of aTextFrame is not nothing then
if parent story's item link's link type of aTextFrame is "InCopyMarkup" then
set mystorytitle to story title of aTextFrame's parent story
set myLabel to label of aTextFrame
set myText to characters 1 thru -1 of mystorytitle as string
--if myText does not contain wrongText then
set myStory to aTextFrame's parent story's contents
copy "Page " & (name of item i of myPages) & " " & mystorytitle & return & myLabel & return & myStory & return & return to end of myStories
end if
end if
--end if
end repeat
end tell
end repeat
end tell
end tell
end processFiles
on processWordDoc(theDocName, mystring, WordDocName)
tell application "Microsoft Word"
activate
set newDoc to make new document
copy styles from template active document template ¬
"Macintosh HD:Users:Shared:headings.dotm"
copy theDocName & mystring to content of text object of newDoc
save as active document file name WordDocName
my textblue()
end tell
end processWordDoc
on textblue()
with timeout of 60000 seconds
tell application "Microsoft Word"
set myPars to every paragraph of active document
set myTitle to text object of paragraph 1 of active document
set color index of font object of myTitle to blue
repeat with aPar in myPars
if content of text object of aPar starts with "Page" then
set myRange to text object of aPar
set color index of font object of myRange to blue
end if
end repeat
end tell
end timeout
end textblue
on RemoveDuplicates(inputList)
set outputList to {}
repeat with i from 1 to length of inputList
-- We make testItem a single-item list to ensure
-- that sublists of the inputList are properly
-- looked for in the outputlist.
--
set thisItem to item i of inputList
set testItem to {thisItem}
if (outputList does not contain testItem) then
set end of outputList to thisItem
end if
end repeat
return outputList
end RemoveDuplicates
Now there is a compile error when the script gets to page in this handler:
on processFiles(theDoc)
tell application "Adobe InDesign CS6"
activate
open theDoc
tell theDoc
set myPages to every page
It says it was expecting a class but found an identifier–which is wrong because “page” is a class.
I’ve tried to save the script as text, then open that text in Applescript and recompile (internet suggestion) but that does not work. Please help.