6 Replies Latest reply on Dec 18, 2011 2:30 PM by LukeF11

    Applescript/js find/change problem (x-post from InDesign forum)

    LukeF11

      I have some text which needs to be styled in InDesign CS4 which has a bunch of extraneous tags ( eg. <b>, <i>, etc.). I have customised the FindChangeList.txt file that supports the FindChangeByList.applescript file to do things like:

       

       

      {find what:"<i>"}{change to:"^S"}

       

       

      which can then be picked up by a nested style. All good so far.

       

      Problem: the applescript/js will just not 'see' the strings <b> or </b> in FindChangeList.txt. It treats them like they aren't there. I can do it using the find/replace within InDesign, it works fine there, but my problem is that I have hundreds of pieces of copy to import and I'd like to automate as much as possible. Using GREP has the same effect, ie. works in find/replace within InDesign, but not with applescript.

       

      Any help would be greatly appreciated as this is really killing me at the moment. Thanks!

       

      Content of FindChangeList.txt follows. The command in the final line works, the command in the second-last line doesn't.

      (FYI the second line of code contains 'InDesign CS3' regardless of whether I use CS3 or CS4. I guess they didn't update the file)

       

      --FindChangeList.txt

      --A support file for the InDesign CS3 AppleScript FindChangeByList.applescript

      --

      --This data file is tab-delimited, with carriage returns separating records.

      --

      --The format of each record in the file is:

      --findType<tab>findProperties<tab>changeProperties<tab>findChangeOptio ns<tab>description

      --

      --Where:

      --<tab> is a tab character

      --findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).

      --findProperties is a properties record (as text) of the find preferences.

      --changeProperties is a properties record (as text) of the change preferences.

      --findChangeOptions is a properties record (as text) of the find/change options.

      --description is a description of the find/change operation

      --

      --Very simple example:

      --text          {find what:"--"}          {change to:"^_"}          {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}          Find all double dashes and replace with an em dash.

      --

      --More complex example:

      --text          {find what:"^9^9.^9^9"}          {applied character style:"price"}          {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}          Find $10.00 to $99.99 and apply the character style "price".

      --

      --All InDesign search metacharacters are allowed in the "find what" and "change to" properties.

       

      text          {find what:"<b>"}          {change to:"^S"}          {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}          Find all bold and replace with non-breaking space.

      text {find what:"<i>"} {change to:"^S"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find all italics and replace with non-breaking space.