Applescript InDesign Grep Script – Needs updating

Home Forums InDesign Add-ons (Scripts, Scripting, and Plug-ins) Applescript InDesign Grep Script – Needs updating

This topic contains 1 reply, has 1 voice, and was last updated by  Shane Robinson 5 days, 11 hours ago.

  • Author
    Posts
  • #111370

    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

  • #111373

    All sorted, a restart has fixed it :rolleyes:

You must be logged in to reply to this topic.