Applescript find/change problem

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 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>findChangeOptions<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.

You probably should post this in the ID Scripting forum. Here's an example of some simple AppleScript find and changes that might help:
--find and replace keyboard formating
tell application "Adobe InDesign CS5.5"
     --first clear the preferences
     set find text preferences to nothing
    set change text preferences to nothing
    --replaces non breaking space with space
    set find what of find text preferences to "^s"
    set change to of change text preferences to "<0020>"
    set myFoundItems to change text
    --replaces soft return with return
    set find what of find text preferences to "^n"
    set change to of change text preferences to "^p"
    set myFoundItems to change text
    --replaces return space with return
    set find what of find text preferences to "^p<0020>"
    set change to of change text preferences to "^p"
    set myFoundItems to change text
    --replaces 2 returns with return
    set find what of find text preferences to "^p^p"
    set change to of change text preferences to "^p"
    set myFoundItems to change text
    --replaces return, tab, return with return
    set find what of find text preferences to "^p^t^p"
    set change to of change text preferences to "^p"
    set myFoundItems to change text
    --replaces space, return with return
    set find what of find text preferences to "<0020>^p"
    set change to of change text preferences to "^p"
    set myFoundItems to change text
    --replaces space, space with space
    set find what of find text preferences to "<0020><0020>"
    set change to of change text preferences to "<0020>"
    set myFoundItems to change text
    --replaces 3 tabs with tab
    set find what of find text preferences to "^t^t^t"
    set change to of change text preferences to "^t"
    set myFoundItems to change text
    --replaces 2 tabs with tab
    set find what of find text preferences to "^t^t"
    set change to of change text preferences to "^t"
    set myFoundItems to change text
end tell

Similar Messages

  • Find/Change problems within a nested style?

    I have a problem with Find/Change (in both CS4 and CS5) not recognizing text within its “find” parameters when text that fits those parameters is part of a nested style. I want to find any instance of italic in the text, regardless of what paragraph or character style it is, but F/C only intermittently finds italics, both within and without that text existing in a nested style. Has anyone come across this issue?
    There is NOTHING different about the text that is recognized by F/C–or not recognized–that shows up in any of the panels or palettes. There are no font conflicts. I’ve replaced prefs and saved data files. If I go into the character palette and change the italic portion of the nested style to “italic” character style (it shows up in character palette as [none], even though it has a nested style), then F/C finds it for sure; but if I don’t do that, then F/C will sometimes find it, and sometimes not, and sometimes in one instance and not in another! There is no hidden formatting that shows up in story editor. I remade another nested para style with the same formatting but with varying results! Help… I’ve tried everything.

    I have a problem with Find/Change (in both CS4 and CS5) not recognizing text within its “find” parameters when text that fits those parameters is part of a nested style. I want to find any instance of italic in the text, regardless of what paragraph or character style it is, but F/C only intermittently finds italics, both within and without that text existing in a nested style. Has anyone come across this issue?
    There is NOTHING different about the text that is recognized by F/C–or not recognized–that shows up in any of the panels or palettes. There are no font conflicts. I’ve replaced prefs and saved data files. If I go into the character palette and change the italic portion of the nested style to “italic” character style (it shows up in character palette as [none], even though it has a nested style), then F/C finds it for sure; but if I don’t do that, then F/C will sometimes find it, and sometimes not, and sometimes in one instance and not in another! There is no hidden formatting that shows up in story editor. I remade another nested para style with the same formatting but with varying results! Help… I’ve tried everything.

  • GREP find/change problem

    Hi, am trying to execute InDesign's default find/change AppleScript script to fix many formatting issues in a large document. One of them is occurences of a two-digit dollar figure followed by a comma (eg. "$10,") that needs to be changed to have no comma.
    Using GREP I can pick it up by finding "\$\d\d," but when I replace it with "\$\d\d" I get the actual string "\$\d\d". IE. "$10," becomes "\$\d\d" rather than "$10". Am I misundersting how the 'change' part of GREP works? Can any one advise?
    FYI the line in the find/change support .txt doc is:
    grep
    {find what:"\\$\\d\\d,"}
    {change to:"\\$\\d\\d"}
    {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}
    Remove commas after prices.
    ...which includes extra backslashes to escape the backslashes that are part of the GREP expression.
    Any help much appreciated!
    Thanks.

    No, unfortunately lookbehinds don't work with variable-length strings. That's the case with all GREP implemantations, not just InDesign's. You can sort of get around it by using or-constructs, but they soon become unmanageable. Here's an example (split and indented just for clarity, you would need to write all this on one line):
         (?<=\$\d)
         |
         (?<=\$\d\d)
         |
         (?<=\$\d\d\d)
    This one says "if a comma is preceded by $ and a digit OR by $ and two digits OR by $ and three digits, then . . ." As you understand, if you need to allow up to six or seven digits, possibly thousand separators too, then lookbehinds become unpracticable.
    >I'm really struggling to get to grips with how GREP statements work.
    Try this: http://oreilly.com/catalog/9780596156008/
    Peter

  • Find/Change problem

    Hi, I'm trying to do a find/change that finds the first space after text that is tagged with a specific character style, called name, and change it to an en space. So, for example, if I had text:
    Cowboy buckeroo or vaquero
    Cowboy has the name char. sty. applied and I would like to change the space between Cowboy and buckeroo to an en space, but leave the the spaces on either side of or to remain as they are.
    I can't figure out how to do it...can anyone help?
    thanks

    Eugene,
    I only had to do this part:
    Do a GREP search for
    Find
    (.+)
    Change to
    $1~>
    Find Format:
    <charstyle>
    Not sure what the last search does?
    Thanks very much
    Jon

  • CS3 Find/Change Correction

    Fellow Scripters--
    In several places in the Scripting Guide, I set the find/change options to nothing. This is an error. Setting the find/change
    preferences to nothing works; setting find/change
    options to nothing doesn't. It doesn't produce an error message, but it can mess up all subsequent find/change operations.
    The affected objects are:
    AppleScript
    find change text options
    find change grep options
    find change glyph options
    JavaScript
    findChangeTextOptions
    findChangeGrepOptions
    findChangeGlyphOptions
    VBScript
    FindChangeTextOptions
    FindChangeGrepOptions
    FindChangeGlyphOptions
    Do not set any of the above to nothing, NothingEnum.nothing, idNothingEnum.idNothing, null, undefined, or anything similar.
    If you are using the FindChangeByList example script, you might want to remove the lines that do this--I'll get a revised version posted soon. The installed version works fine with the default FindChangeList.txt file, but will cause problems if you try to use more complex grep expressions.
    Thanks,
    Ole

    Here is the version of the script for CS4 (it works in CS3 as well, much better than original CS3 version).
    http://forums.adobe.com/servlet/JiveServlet/download/2080627-12695/FindChangeByListCS4.zip
    You can also use Martin Fisher's script to record settings from Text and GREP tabs, then copy and paste them to FindChandgeList.txt file.
    http://www.kasyan.ho.com.ua/downloads/RecordFindChange_CS3_Kas.zip
    Check out also this script: http://www.kasyan.ho.com.ua/find_change_by_queries.html
    Kasyan

  • [CS3 JS] Find/Change Object Problem

    app.changeObjectPreferences = NothingEnum.nothing does not seem to clear the change object preferences for me.
    app.findObjectPreferences = NothingEnum.nothing works as expected, as do both app.findTextPreferences = NothingEnum.nothing and app.changeTextPreferences = NothingEnum.nothing.
    Does anyone else use the new Find/Change Object?

    Hello. I'm new here but it seems to be the only place where I can post this question to.
    I'm working in a C# application that uses InDesign CS3 scripting. I'm trying to create an index automatically from a tabbed list of words in a text file.
    As C# is a strongly typed language, I have to cast all objects to the right type. I'm having problems when I try to add the page numbers to the created index entries using the following code (I've used the CreateIndexEntry.jsx scrip as a starting point).
    //Find all occurrences of the word or set of words (the topic name)
    ((InDesign.FindTextPreference) app.FindTextPreferences).FindWhat = topic.Name;
    InDesign.Objects foundTexts = doc.FindText(System.Reflection.Missing.Value);
    It's supposed to be an Array of Text objects (InDesign.Text) but when I try to cast each object using this
    //Code is forced because I've tried everything here
    //Loop through each finding and add page numbers to topic
    IEnumerator textEnum = foundTexts.GetEnumerator();
    while (textEnum.MoveNext())
    object text = textEnum.Current;
    topic.PageReferences.Add((InDesign.Text)text, InDesign.idPageReferenceType.idCurrentPage, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
    I got the following exception (translated).
    text is not an InDesign.Text object (Interfaces doesn't match)
    So the question is what object type should I use to cast each object resulting by calling the Document's FindText method.
    Every suggestion will ve very welcome.
    Thank You very much.

  • I have Photoshop CS purchased many years ago for a LOT of money.  Other day went to use it, got msg. "computer configuration changed, need to re-activate".  Tried that for days, didn't work.  Cannot call ANYONE to find out problem.  Am not very computer l

    I have Photoshop CS, purchased many years ago for a LOT of money.  Other day went to use it, got msg. "computer configuration changed, need to re-activate.  Tried that for days, didn't work.  Cannot call ANYONE to find out problem.  Am not very computer literate, so don't understand what that means.  LOVE the CS program and know how to use it, so don't want to have to learn something new.  Don't know what to do.  Went to all the big name stores and no one can tell me anything, like what happened to CS or what is replacing it that is the same as CS.  CAN SOMEONE PLEASE HELP!!!     

    jd49034389 wrote:
    down further there is a Photoshop CS2, do I just do that one?
    Yep. That's the one. Make sure to use the supplied key on the download page, not your old one.
    Good luck.
    --OB

  • Text find and change problem in CS3 and CS4 script

    I use the script below to find some text and change into others.
    There is one thing the script can't do it for me.
    Example:
    (g) Management
    (1) that no law which is enacted in the Cayman Islands imposing any tax to be levied on profits, income, gains or appreciation shall apply to the Company or its operations; and
    (2) that the aforesaid tax or any tax in the nature of estate duty or inheritance tax shall not be payable on or in respect of the shares, debentures or other obligations of the Company.
    Example:(END)
    I got a lot of topics or points in the passage. And I want to change the space between '(g)' and 'Management' into a tab character. So I revised the plain text file 1text.
    PS: 1text.txt is filled with what to change.
    text {findWhat:"^p(^?) "} {changeTo:"^p(^?)^t"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all space-dash-space and replace with an en dash.
    The result is:
    (^?)^tManagement
    (^?)^tthat no law which is enacted in the Cayman Islands imposing any tax to be levied on profits, income, gains or appreciation shall apply to the Company or its operations; and
    (^?)^tthat the aforesaid tax or any tax in the nature of estate duty or inheritance tax shall not be payable on or in respect of the shares, debentures or other obligations of the Company.
    PS: ^t is a tab character.
    result (END)
    This is not what I want.
    It should be '(g)^tManagement'.
    PS: ^t is a tab character.
    Please someboady help me out to revised the script below to change the text into what I want. Thanks so much.
    Here is the script.
    //FindChangeByList.jsx
    //An InDesign CS4 JavaScript
    @@@BUILDINFO@@@ "FindChangeByList.jsx" 2.0.0.0 10-January-2008
    //Loads a series of tab-delimited strings from a text file, then performs a series
    //of find/change operations based on the strings read from the file.
    //The 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>findChangeOptions<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 {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
    //More complex example:
    //text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"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 "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
    //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
    //as shown in the example below:
    //{findWhat:"\\s+"}
    //For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
    main();
    function main(){
    var myObject;
    //Make certain that user interaction (display of dialogs, etc.) is turned on.
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    if(app.documents.length > 0){
      if(app.selection.length > 0){
       switch(app.selection[0].constructor.name){
        case "InsertionPoint":
        case "Character":
        case "Word":
        case "TextStyleRange":
        case "Line":
        case "Paragraph":
        case "TextColumn":
        case "Text":
        case "Cell":
        case "Column":
        case "Row":
        case "Table":
         myDisplayDialog();
         break;
        default:
         //Something was selected, but it wasn't a text object, so search the document.
         myFindChangeByList(app.documents.item(0));
      else{
       //Nothing was selected, so simply search the document.
       myFindChangeByList(app.documents.item(0));
    else{
      alert("No documents are open. Please open a document and try again.");
    function myDisplayDialog(){
    var myObject;
    var myDialog = app.dialogs.add({name:"FindChangeByList"});
    with(myDialog.dialogColumns.add()){
      with(dialogRows.add()){
       with(dialogColumns.add()){
        staticTexts.add({staticLabel:"Search Range:"});
       var myRangeButtons = radiobuttonGroups.add();
       with(myRangeButtons){
        radiobuttonControls.add({staticLabel:"Document", checkedState:true});
        radiobuttonControls.add({staticLabel:"Selected Story"});
        if(app.selection[0].contents != ""){
         radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
    var myResult = myDialog.show();
    if(myResult == true){
      switch(myRangeButtons.selectedButton){
       case 0:
        myObject = app.documents.item(0);
        break;
       case 1:
        myObject = app.selection[0].parentStory;
        break;
       case 2:
        myObject = app.selection[0];
        break;
      myDialog.destroy();
      myFindChangeByList(myObject);
    else{
      myDialog.destroy();
    function myFindChangeByList(myObject){
    var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
    var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, myStory;
    var myStartCharacter, myEndCharacter;
    var myFindChangeFile = myFindFile("/FindChangeSupport/1test.txt")
    if(myFindChangeFile != null){
      myFindChangeFile = File(myFindChangeFile);
      var myResult = myFindChangeFile.open("r", undefined, undefined);
      if(myResult == true){
       //Loop through the find/change operations.
       do{
        myLine = myFindChangeFile.readln();
        //Ignore comment lines and blank lines.
        if((myLine.substring(0,4)=="text")||(myLine.substring(0,4)=="grep")||(myLine.substring(0, 5)=="glyph")){
         myFindChangeArray = myLine.split("\t");
         //The first field in the line is the findType string.
         myFindType = myFindChangeArray[0];
         //The second field in the line is the FindPreferences string.
         myFindPreferences = myFindChangeArray[1];
         //The second field in the line is the ChangePreferences string.
         myChangePreferences = myFindChangeArray[2];
         //The fourth field is the range--used only by text find/change.
         myFindChangeOptions = myFindChangeArray[3];
         switch(myFindType){
          case "text":
           myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
          case "grep":
           myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
          case "glyph":
           myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
       } while(myFindChangeFile.eof == false);
       myFindChangeFile.close();
    function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change preferences before each search.
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences = NothingEnum.nothing;
    var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    myFoundItems = myObject.changeText();
    //Reset the find/change preferences after each search.
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences = NothingEnum.nothing;
    function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change grep preferences before each search.
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences = NothingEnum.nothing;
    var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    var myFoundItems = myObject.changeGrep();
    //Reset the find/change grep preferences after each search.
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences = NothingEnum.nothing;
    function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change glyph preferences before each search.
    app.changeGlyphPreferences = NothingEnum.nothing;
    app.findGlyphPreferences = NothingEnum.nothing;
    var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    var myFoundItems = myObject.changeGlyph();
    //Reset the find/change glyph preferences after each search.
    app.changeGlyphPreferences = NothingEnum.nothing;
    app.findGlyphPreferences = NothingEnum.nothing;
    function myFindFile(myFilePath){
    var myScriptFile = myGetScriptPath();
    var myScriptFile = File(myScriptFile);
    var myScriptFolder = myScriptFile.path;
    myFilePath = myScriptFolder + myFilePath;
    if(File(myFilePath).exists == false){
      //Display a dialog.
      myFilePath = File.openDialog("Choose the file containing your find/change list");
    return myFilePath;
    function myGetScriptPath(){
    try{
      myFile = app.activeScript;
    catch(myError){
      myFile = myError.fileName;
    return myFile;

    It takes me a lof of time to comprehend the sentence you write. Cause I am a Chinese. My poor English.
    I have to say "you are genius". I used to use the indesign CS2. There is no GREP function in CS2. When I get the new script, I do not know how to use it. Just when I saw the
    'grep {findWhat:"  +"} {changeTo:" "} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.'
    Being confused.
    Thanks so much. It seems I have to relearn the advanced Indesign.

  • Problems w/ver 27 and xp sp3; should I give up on xp and go to Win 7 PRO 64bit where I find no problems?

    OS = Win XP SP3
    Cannot change/edit location of downloads; the only download available is DOWNLOADS
    This ver of MF takes about 15 seconds to load NASCAR website
    After I select any website to load a small, rotating circle appears in the upper-left of the screen and remains until, finally, the page has completely loaded.
    I do not have this problem w/win 7 pro 64 bit
    Installing MF 4 solves this problem on the Win XP SP3 OS.
    I do not find this problem on older laptops running the same XP OS.

    Have you done any routine maintenance on that computer recently?
    What happens if you use a different browser on that computer?
    Are you running the most up-to-date version of Firefox on that computer?
    What do you mean by MF4?

  • Finished script: Use grep find/change to fill in a supplied table of contents

    This script is now complete, and has been the subject of most of my previous posts. Just in case anyone wanted to know what the finished script ended as, here it is.
    Thanks so much to all. A lot of really helpful folks on this board are very responsible for the success of this task. This script is to be one of hopefully many in the creation of our records. But it's a huge leap forward. Thanks again to everyone that helped.
    Cheers,
    ~Nate
    Task:
    Automatically find town names in listings, and fill in table of contents template on page 2 accordingly.
    Example of page 2 toc, initially:
    Example of a page of content. The town names are what need to be referenced on the TOC:
    Example of page 2 toc once script is finished:
    Because of the need to include the transaction dates on the TOC (comes as a provided, tagged-text file), a simple Indesign-generated TOC can't be used alone.
    This script uses an Indesign-generated TOC that's on a master page called "T-tocGen" ... It then uses grep search and replaces to grab the needed information, and insert it into the page 2 TOC.
    The script will update a generated TOC and then search for an instance of a page number, and town name. The generated toc lists all included towns in the following format:
    (line start)## tab townName(line end)
    In Grep, this would be (please note, extra \ for \d and \t ... javascript needs that for some reason):
    ^\\d+\\t(.*)$
    After the script gets the info it needs from a found instance of the above, it replaces that line with "---", to prevent that line from being picked up once again.
    The script with then place the needed page number in it's rightful place on page 2, replacing the XX.
    A while loop is used to repeat the above process until there are no longer any instances of "^\\d+\\t(.*)$" present.
    Not every town runs every issue, so once the script is done, it removes all remaining instance of "XX" on the page 2 TOC.
    FINAL CODE:
    TOC replace
    This script will use grep find/change methods to apply page numbers in
    tocGen to the XX's on page2TOC.
    // define the text frame of generated TOC
        var tocGenFrame  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
    // udpate generated TOC ... store contents in tocGenStuff
        var tocGenStuff = updateTOCGen();
    // set variable for while loop
    var okGo = "1";
    // while okGo isn't 0
    while(okGo.length!=0)
    // get town info from tocGen
    getCurrentTown();
    // replace XX's with tocGen info
    replaceTown();
    // grep find ... any remaining towns with page numbers in tocGen?
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // set current value of okGo ... with any instances of above grep find in tocGen
    okGo = tocGenFrame.findGrep();   
    // grep find/change all leftover XXs in page2TOC
    app.findGrepPreferences = app.changeGrepPreferences = null;       
    app.findGrepPreferences.findWhat = "^XX\\t";
    app.changeGrepPreferences.changeTo = "\\t";
    app.activeDocument.changeGrep();  
    // clear grep prefs
    app.findGrepPreferences = app.changeGrepPreferences = null;
    //  functions                  //
    function getCurrentTown()
    // grep options   
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // grep find:  startLine anyDigits tab anyCharacters endLine
          app.findGrepPreferences = app.changeGrepPreferences = null;
          app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // get grep find results      
    currentGen = tocGenFrame.findGrep();  
    // store grep results content into currentLine
    currentLine = currentGen[0].contents;
    // match to get array of grep found items
    currentMatch = currentGen[0].contents.match("^\\d+\\t(.*)$");
    // second found item is town name, store as currentTown
    currentTown = currentMatch[1];
    // change current line to --- now that data has been grabbed
    // this is because loop will continue as long as the above grep find yields a result
           app.findGrepPreferences.findWhat = "^\\d+\\t"+currentTown+"$";
                  app.changeGrepPreferences.changeTo = "---";
                tocGenFrame.changeGrep(); 
    function replaceTown()
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // find: XX currentTown .... replace with: currentLine
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "^XX\\t"+currentTown+" \\(";
        app.changeGrepPreferences.changeTo = currentLine+" \(";
    app.activeDocument.changeGrep();   
    function updateTOCGen()
    //set vars ... toc text frame, toc master pag
        var tocGen  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
        var tocGenPage  = document.masterSpreads.item("T-tocGen").pages.item(0);
    //SELECT the text frame generatedTOC on the master TOC
        tocGen.select();
    //Update Table of Contents by script menu action:
        app.scriptMenuActions.itemByID(71442).invoke();
    //Deselect selection of text frame holding your TOC:
        app.select(null);
    //store contents of toc text frame in variable
        var tocGenText = tocGen.contents;
    //return contents of tocGen
        return tocGenText;

    Thanks for the reply.
    You are correct but the problem is there are three rows, One row is 100% black, the second is 60% black and the third is 40% black. I want to change the black to blue, the 60% black to an orange and the 40% black to a light shaded blue. In the find/change option you can select the tint you want to find and replace but yea.. does work on table cells.. oddly enough.

  • Find/Change words (with GREP) and apply a style...

    I need a Script for Find/Change words with GREP, and apply a paragraph style...
    Thanks...

    Hi Marcos,
    If you want the script to create character styles: Bold , Italic, Bold Italic, etc, and replace local formatting with these styles, use scripts in post #3.
    But if you want find and change words, or/and replace local formatting with styles defined by you, use FindChangeByList script.
    If the latter, I recommend you to download and install Record Find Change script (written by Martin Fisher).
    Then choose settings you need in Find-Change dialog – make sure they work as expected – and run Record Find Change script. A Notepad/TextEdit file will pop up with a line containing the recorded setting. Copy it, open FindChangeList.txt, delete the contents of this file and paste the line you just copied (or add it to the bottom of the file).
    Repeat the process for all find-change operations you need.
    Finally run FindChangeByList.jsx to make all changes in one go.
    However, while using Record Find Change script, you may encounter a problem: it doesn’t record paragraph and character styles placed inside a group. But you can write references to such styles like so:
    appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Style Group 1"). paragraphStyles.item("Paragraph Style 1")
    Kasyan

  • FIND/CHANGE - Applying Paragraph Style

    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.

    graphicsoc wrote:
    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.
    If I understand your request correctly:
    If your paragraph style uses a numbered list to create the "A." and the remainder of the paragraph consists of only "# 70712" that you type in manually (or place from an existing file), I believe that you you don't need GREP. You can format the auto-numbered list differently from the remainder of its paragraph, by specifying a character style for the number portion.
    To extract only the non-numbered portion of an auto-numbered paragraph, for a TOC, in the Table of Contents dialog box, open the bottom part by clicking More Options if necessary, and in the Numbered Paragraphs pull-down menu, select Exclude Numbers.
    Read more about Table of Contents in Help, and/or with a Google search for terms like "InDesign table of contents numbered list exclude numbers" without quotes.
    If you need additional special formatting "tricks" in the source paragraphs, or in the TOC entry paragraphs, look into Nested Styles and GREP
    Styles in Help or Google searches.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How do I use AppleScript to Change the Creation Date to the Current Date?

    I sorted my downloads folder by creation date and found that the items were sorted seemingly randomly. On closer inspection, I saw that the creation dates were not the same as the dates that I downloaded the items, so I figures that Snow Leopard was using the date given to it by the server.
    In order to get the items sorted by download date, I figured I'd use Hazel, but it doesn't have a “change creation date” item. It does, however, have an “run AppleScript” item.
    So my question is this: how do I use AppleScript to change the creation date of an item to the current date?

    TC (Techno Cat) wrote:
    Okay, I tried changing the creation date with SetFile, but it kept giving me an error:
    What am I doing wrong?
    Looks like the date and time was not quoted
    Try this Applescript. It will change the creation date of every file in the Downloads folder to the current date and time:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #E6E6EE;
    overflow: auto;"
    title="this text can be pasted into the AppleScript Editor">
    set current_date_and_time to do shell script "date \"+%m/%d/%Y %H:%M\""
    tell application "Finder"
    set filelist to every file of the alias (the path to downloads folder as text)
    repeat with currentFile in filelist
    do shell script "/usr/bin/SetFile -d " & quoted form of current_date_and_time & space & quoted form of POSIX path of (currentFile as string)
    end repeat
    end tell</pre>

  • How to use character styles in the Find/Change JavaScripts?

    First, good luck to Ole. He's been so helpful (and such a good writer, too). All the best!
    My Find/Change JavaScripts are running into trouble at line 159 of the ExtendScript Toolkit. The script is searching for a particular font, to which it should then apply a character style. I'm using the format I see in Adobe's "FindChangeList" sample text, but the script is still hitting a wall. What am I doing wrong? I'd like to have a working method for searching, not only for fonts, but also for finding a particular character or paragraph style and then applying a new style.
    Simple stuff, but I'm roadblocked.
    Here is the script so far:
    //This script applies the DFKai character style to the Arial Unicode font.
    text {findWhat:"", appliedFont:"Arial Unicode MS", fontStyle:"Regular"} {appliedCharacterStyle:"DFKai"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find Unicode font; change to DFKai character style.
    Thanks for your help!
    Gary Niemeier

    You are absolutely correct. I don't know how those spaces got there! I copied the text from the "FindChangeList.txt" document, but somewhere along the way, a software program "helpfully" added the spaces. (Rest assured, it wasn't copied from AppleScript. I stick with JavaScript.) Anyway, the script now runs like a charm.
    My thanks to you! Another "newbie" mistake easily spotted, eh?
    One thing, though, if Adobe is reading this: please flesh out the "FindChangeList.txt" file for those who are not programmers/scripters. I'm just a normal InDesign user, and I really need examples of basic syntax in order to use the "Find/Change" script correctly. I'm referring to the syntax involved with finding or changing text with a certain character or paragraph style. I often search for styles, and those properties should be provided in the help file. A couple of samples are all that's needed. (I did read through the JavaScript reference guide provided by Adobe, and even in the "Find/Change" section, it did not provide this information!). Furthermore, I often search text for a specific font. Why isn't this syntax included as well? It would easy to do and would save users a lot of fumbling around.
    Thanks again, all the best.

  • How to find possible problem clip(s)

    My current project has over 500clips. The majority are video (~400) with some cross fades. There are a few titles (9) ,some stills and some audio tracks. Not enough FX to cause problems I think.
    Somewhere in there there seems to be a clip (or more than one) that causes the RAM to fill up more than other projects and the fan to run at high speed. Had the constant fan running issue in the previous version (10.0.7) but that cleared up in 10.0.8. This happens as soon as I launch FCPX with that project selected. The other problem is that as my RAM fills up the system response slows down. Even my mouse movements show on the screen as jerky and inaccurate.
    I've deleted preferences with Preference Manager and only have the one project visible to FCP - that doesn't change anything. Also tried duplicating the project and deleting render files - again no improvement.
    So my question is do any of you have any suggestions? I'd love to stop the high speed fan running all the time. If this is an issue with a bad clip (or several) is there any way I can find the problem short of going through and removing them one by one until I either find the problem or go crazy trying?
    MBP, 10.7.5, i7, 8 gb RAM
    Thanks.

    Thanks for the rapid response Tom.
    The project is 720p, 59.94 fps
    Codecs: AAC, H.264 (GoPro footage) and H.264, Linear PCM (Panasonic HDC-TM700 footage)
    Audio: 48 kHz from GoPro and Panasonic cameras, 44.1 kHz recorded music. Audio output channels: 2.  Audio Configuration: 1 Stereo
    There are a couple of compound clips that don't show any codecs. I have noticed a couple of other clips (there may be more) that play fine but any codecs when displaying info.
    My knowledge isn't deep enough to know if these numbers answer your question or if these specs are ok. The problem started before I added any still images so I suspect they're innocent.

Maybe you are looking for

  • New to Soundbooth....How can I export audio from a .flv file?

    Hi, I am sorta new to SB.  My girlfriend has purchased a study program that has numerous .flv files on a DVD.  She has asked if I can take the audio and convert each movie to an .mp3, (so that she can listen to the videos on her Iphone).  I figured I

  • Interfaces in webdynpro java

    Hi all, I have a doubt about the programming in webdynpro java interfaces . what is the main concept underlying in context of a particular view, why to use the follwing code for referring to context attribute IPrivate<viewname>.I<NodeName> node = wdC

  • HEAT = Intermittent freezing or complete crash requiring a hard reboot

    I have a stock Macbook Air 1.6ghz with the hard drive and I'm on my second machine. Both have done the same thing leading me to believe there is a serious defect in the Macbook Air. What happens is that after about a half hour of using the machine an

  • OWB 10.2.0.4 ANSI SQL join problem

    Hi Its seams to me, that in OWB 10.2.0.4 there is something broken with ANSI SQL joins and instead of ANSI joins there is used oracle SQL joins only. Maybe someone can point some solutions? I can't rewrite all mappings with union and other operators.

  • Does my iPad model MD335LL have a retina display?

    I'm confused,.... My iPad was called "The new iPad" when I bought it from the Apple Store two months ago. It is model MD335LL. Does it have the retina display?