Hi all - posting here separately from another post of mine to simplify my query - hopefully someone can help.
I have the below script which works effectively so long as I use a specific Illustrator template as the target document - BUT if I choose an entirely different document that has all the same elements (essentially a duplicate) the “Story” number changes from “4” to another number and the script fails. Is there a way to alter this “Story” number in the duplicate Illustrator documents to “4” so the script can operate effectively regardless of the target document?
Addendum (if it matters, the contents of the clipboard are copied from 5 Excel cells)
set theClipboard to the clipboard as text
– Split each cell into its own line
set AppleScript’s text item delimiters to tab
set theCells to text items of theClipboard
set AppleScript’s text item delimiters to return
set theModifiedText to theCells as text
– Add two line breaks before the last cell
set theLines to paragraphs of theModifiedText
set theLastLineIndex to count of theLines
set item (theLastLineIndex - 1) of theLines to item (theLastLineIndex - 1) of theLines & return
set theModifiedText to theLines as text
set the clipboard to theModifiedText
tell application “Adobe Illustrator”
activate
tell document 1
select of {text from character 1 to character 66 of story 4 of document 1 of application “Adobe Illustrator”}
set contents of text range of story of selection to the clipboard
end tell
end tell
end