Copy link to clipboard
Copied
Hi All.
I had an applescript that was working in Indesign 2015, however, I've returned to use it with Indesign 2018 and it keeps intermittently failing.
The script would set find / change values, search the doc and return the text found, I would then use this text to form the file name for saving.
[applescript]
tell application "Adobe InDesign CC 2015"
activate
set myFindGrep to ".+"
set mySelectedParaStyle to "DM Product Code Split"
set MyFoundWordsList to {}
--
--
set find what of find grep preferences to myFindGrep
set applied paragraph style of find grep preferences to mySelectedParaStyle as string
--
--
set MyFoundWords to find grep
--
--
repeat with i from 1 to count MyFoundWords
set MyFoundWordsList to MyFoundWordsList & item i of MyFoundWords
end repeat
--
set lastInList to count MyFoundWordsList
set mySave to (myDesktopJobFolderPath & (item lastInList of MyFoundWordsList) & ".indd")
end tell
[/applescript]
I'm getting a couple of different errors on the line…
[applescript]
set MyFoundWordsList to MyFoundWordsList & item i of MyFoundWords
[/applescript]
Error 1:
Can’t make text from character 1 to character 8 of story id 332 of document id 603 of application "Adobe InDesign CC 2018" into type vector.
Error 2:
Can’t make text from character 1 to character 6 of story id 331 of document id 611 of application "Adobe InDesign CC 2018" into type vector.
The text it's searching is just alpha/numeric codes, no special characters.
thanks
Shane
Copy link to clipboard
Copied
Hi,
Can you share one of the documents that has the problem so that we can try to replicate the issue?
(as files cannot be shared on this forum directly, please use a file sharing site of your choice)
Regards
Malcolm
Copy link to clipboard
Copied
Script runs smooth, doesnt seem broken to me. We need a testfile, to see what InD is fetching wrong.
Copy link to clipboard
Copied
Thanks to BarlaeDC & DBjan for the swift replies.
I was just about to upload a test file and I thought I'd just run it again to tell you which pages it fails on…
…and today it's working!
The only difference is a restart in-between, I guess this flushed something out.
Thanks for the offer of help, much appreciated.