3 Replies Latest reply on Nov 8, 2018 5:12 AM by sr48262525

    Applescript InDesign Grep Script - Needs updating

    sr48262525 Level 1

      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:

      [i]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.[/i]

       

       

      Error 2:

      [i]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.[/i]

       

       

      The text it's searching is just alpha/numeric codes, no special characters.

       

      thanks

      Shane