Script to find/replace regular to Italic based on search terms in .txt

Sorry for such a newbie post.
I have been reading on JS scripts for find/replace.  I'm hoping develop a script or find one that is written that
1. Looks into a .txt or any searchable file format, containing search terms
2. Script will run on the entire Indesign document
3. For any matching search terms script replace the style from regular to Italic, or from Bold to Bold/Italic. 

Perfectly doable. Do you want to give it a go yourself?
A few first thoughts (things I'd probably solve myself while writing the script):
1. JS can read any file, but getting just the plain text out of an MS Word document is kind of ambitious -- even for me. Keep it simple: if your search text is nothing but a list of keywords or short phrases, write them out in a plain text file, one search item per line.
2. With that I presume you mean not on one single continuous story, but all over the file -- including loose text frames, master pages, and what-have-you-got. Thass' easy, you can set the target for a Find or Replace operation with pin-point accuracy.
3. .. This is the interesting part, actually.
(a) Do you want to change the text style? That will set an override "+" for the modified text. It would be safer (wiser, etc.) to change it using a character style. (For the script it doesn't matter which method you use, this is just for the Future You who is going to edit this file in 6 months.)
(b) If you do use a character style: what should happen if there already is one applied? Not bold or italic, but underline, for instance. Applying a new char style will override this one.
(c) The naive approach (which I probably would have taken first) is to first search for each of the search terms, go over the 'found' list and test for each single entry if it's in regular or bold, then take appropriate action.
A better approach -- without knowing anything else about this document -- could be to blindly use Replace to change ALL search terms in "Regular" to "Italic" and ALL search terms in "Bold" to "Bold Italic". It sure would be faster.
(d) Just like in the interface, you can search for a word and 'change' only the formatting -- no need to change the text as well. And just like in the interface, you need to specify "whole words" and/or "case sensitive".

Similar Messages

  • BAPI to search for customer in CRM based on search terms

    Hi,
    Could anyone please tell me if there is a function module in CRM to search for BP's based on search terms. ( Just as we could enter '*' in search terms in transaction BP and get a list of customers ).
    Thanks in advance,
    Sahil

    Hi Sahil,
    You can make use of BAPI_BUPA_SEARCH.
    In the import parameter CENTRALDATA you can pass the
    search terms.
    Ranjit

  • How can I remove all content between two tags using Find/Replace regular expressions?

    This one is driving me bonkers...  I'm relatively new to regular expressions, but I'm trying to get Dreamweaver to remove all content between two tags in an XML document.  For example, let's say I have the following XML:
    <custom>
    <![CDATA[<p>Some text</p>
    <p>Some more text</p>]]>
    </custom>
    I'd like to do a Find/Replace that produces:
    <custom>
    </custom>
    In essence, I'd like to strip all of the content between two tags.  Ideally, I'd like to know how to strip the CDATA content as well, to return the following:
    <custom>
    <![CDATA[]]>
    </custom>
    I'd much appreciate any suggestions on accomplishing this.
    Many thanks!

    Thanks much for your response.  I found David's article to be a little thin with respect to examples using quantifiers in coordination with the wildcard metacharacters; however, I was able to cobble together a working expression through trial and error using the information he presented.  For posterity, here’s the solution:
    Find:
    <custom>[\d\D]*?</custom>
    Replace:
    <custom>
    <![CDATA[]]>
    </custom>
    I believe this literally translates to:
    [] = find anything in this range/character class
    \d = find any digit character (i.e. any number)
    \D = find any non-digit character (i.e. anything except numbers)
    *? = match zero or more times, but as few times as possible (i.e. match multiple characters per instance, but only match one instance at a time, or none at all)
    I’m still not sure how to effectively utilize the . wildcard.  For example, the following expression will not find content that ends with a number:
    <custom>.*?[\D]*?</ custom >
    I'm presuming this is because numbers aren't included in the \D metacharacter; however, shouldn't numbers be picked up by the .*? expression?

  • Find & replace part of a string in Numbers using do shell script in AppleScript

    Hello,
    I would like to set a search-pattern with a wildcard in Applescript to find - for example - the pattern 'Table 1::$*$4' for use in a 'Search & Replace script'
    The dollar signs '$' seem to be a bit of problem (refers to fixed values in Numbers & to variables in Shell ...)
    Could anyone hand me a solution to this problem?
    The end-goal - for now - would be to change the reference to a row-number in a lot of cells (number '4' in the pattern above should finally be replaced by 5, 6, 7, ...)
    Thx.

    Hi,
    Here's how to do that:
    try
        tell application "Numbers" to tell front document to tell active sheet
            tell (first table whose selection range's class is range)
                set sr to selection range
                set f to text returned of (display dialog "Find this in selected cells in Numbers " default answer "" with title "Find-Replace Step 1" buttons {"Cancel", "Next"})
                if f = "" then return
                set r to text returned of (display dialog "Replace '" & f & "' with " default answer f with title "Find-Replace Step 2")
                set {f, r} to my escapeForSED(f, r) -- escape some chars, create back reference for sed
                set tc to count cells of sr
                tell sr to repeat with i from 1 to tc
                    tell (cell i) to try
                        set oVal to formula
                        if oVal is not missing value then set value to (my find_replace(oVal, f, r))
                    end try
                end repeat
            end tell
        end tell
    on error number n
        if n = -128 then return
        display dialog "Did you select cells?" buttons {"cancel"} with title "Oops!"
    end try
    on find_replace(t, f, r)
        do shell script "/usr/bin/sed 's~" & f & "~" & r & "~g' <<< " & (quoted form of t)
    end find_replace
    on escapeForSED(f, r)
        set tid to text item delimiters
        set text item delimiters to "*" -- the wildcard 
        set tc1 to count (text items of f)
        set tc2 to count (text items of r)
        set text item delimiters to tid
        if (tc1 - tc2) < 0 then
            display alert "The number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string."
            error -128
        end if
        -- escape search string, and create back reference for each wildcard (the wildcard is a dot in sed) --> \\(.\\)
        set f to do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g;s/\\*/\\\\(.\\\\)/g' <<<" & quoted form of f
        -- escape the replacement string, Perl replace wildcard by two backslash and an incremented integer, to get  the back reference --> \\1 \\2
        return {f, (do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g' | /usr/bin/perl -pe '$n=1;s/\\*/\"\\\\\" . $n++/ge'<<<" & (quoted form of r))}
    end escapeForSED
    For what you want to do, you must have the wildcard in the same position in both string. --> find "Table 1::$*$3", replace "Table 1::$*$4"
    Important, you can use no wildcard in both (the search string and the replacement string) or you can use any wildcard in the search string with no wildcard in the replacement string).
    But, the number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string.

  • A Script to Find and Replace Layer Names

    Are there any scripts to find and replace layer names?
    There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.
    The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
    Ideally, it would be great if there was something that could do multiple find and replaces in one go:
    (e.g.
    You have layers like this Car, Dog, Bat
    You enter: car(Option1), dog(Option2), Bat(Option3)
    Your layers then become: Option1, Option2, Option3).

    big_smile, that's a very good start! Step 1 of Learning How To Script is indeed, adjusting an existing simple script to make it do more complicated things. (And usually then "break something", which is also a required part of the process.)
    You are correct in your observation this is repetitive stuff. For one or two different items that wouldn't be a problem, but in longer lists you soon get lost.
    The usual way of working with find-change lists is to build an array:
    var layernames = [
    [ 'FHairBowlBoy *Hair', 'Hairboy1' ],
    [ 'FHairCurlyafroBoy *Hair', 'Hairboy2' ],
    [ 'FHairSpikyBoy *Hair', 'Hairboy3' ],
    The general idea is to loop over all names, check if the current layer name is "layernames[i][0]" (the left column) and if so, rename it to "layernames[i][1]" (the right column). If you know how to write a loop in Javascript, then you can implement this right away.
    However ..
    A more advanced way to do this doesn't even need loop to over all layernames -- instead you can immediately "get" the correct name per layer! It's magic! Almost!
    The trick is to use a Javascript object instead of an array. Javascript objects are nothing special; Illustrator's 'layers' is an array of objects, and each object "layer" has a property "name", whose value you can read and set. What I do here is create a new object, where the "name" part is the original layer name and its value is the new layer name. All you need to check for per each layer is if there is a property 'object.originalLayerName', and if so, assign its value to that layer name.
    This looks a bit like the array above, except that (1) you use {..} instead of [..] to create an object, and (2) you add "name:value" pairs instead of "value" only (actually, the 'name' of a value in an array is simply its number).
    So this is what it looks like:
    // JavaScript Document
    var doc = app.activeDocument;
    // name indexed object
    var layernames = {
    'FHairBowlBoy *Hair':'Hairboy1',
    'FHairCurlyafroBoy *Hair':'Hairboy2',
    'FHairSpikyBoy *Hair':'Hairboy3'
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++)
    //Set up Variable to access layer name
    var currentLayer = app.activeDocument.layers[i];
    if (layernames[currentLayer.name])
      currentLayer.name = layernames[currentLayer.name];
    Enjoy!

  • "Multiple Line" Regular expressions in find/replace

    Hi there,
    I'm wondering if it is possible to find and replace (in batch
    mode) the following obstacle:
    say is have this piece of code in every html file i'd like to
    edit:
    <html>
    <blah blah (Same text in all files)>
    <blah blah (NOT same text in all files)>
    <blah blah (NOT same text in all files)>
    <code that is the same again in all files>
    and would like to replace it by nothing, effectively deleting
    the part completely... (by leaving the replace by field empty).
    The tricky part is that the lines which are NOT the same in
    all files, are sometimes 2 lines, but sometimes 3 or more lines.
    Somehow I need to get the regular expression to include
    <line>* (or something similar), in order to make the regular
    expression work.
    Any ideas on how to solve this? I must say untill now, the
    Dreamweaver search and replace function has been the most effective
    one, compared to many alternatives out there.
    Rp

    I've tried \1 and $1Just these in the text items of the find & replace dialog box...?????
    Can you write down exactly what have you tried....(text to be replaced by which....)????
    Greetings....
    Sim

  • Scripts you find useful

    Just wanted to get maybe a few new free scripts and wondering if anyone is willing to share any links or code of cool scripts they have in their arsenal that just makes things easy for them.
    Here's some of my favourties that I've accumulated over the years
    Apply Clipping Path
    For some reason clipping paths may or not be applied to your photohsop files. If you turn on or off the clipping path for one image, then select the rest of the images and run the script it will apply or unapply the clipping path!
    Create Hex Swatches
    Speaks for itself really
    http://indesignsecrets.com/create-hexadecimal-color-swatches-in-indesign-for-interactive-d ocuments.php
    Footnotes to Endnotes
    Various reasons for doing this, mainly because indesign can't handle spanning footnotes across two columns!
    But it's very handy and has a lot of uses!
    http://www.kahrel.plus.com/indesign/foot_to_endnote.html
    This script takes it one step further by creating the cross-reference, if you need that functionality
    http://www.kahrel.plus.com/indesign/foot_add_delete.html
    *****FAVOURITES COMING UP******
    Multipage Importer
    Import and place multiple PDF pages or InDeisgn Pages directly into your indesign document!
    http://indesignsecrets.com/zanelli-releases-multipageimporter-for-importing-both-pdf-and-i ndd-files.php
    Preptext
    There others mentioned in the link below. But Preptext is fantastic for taking in Word file that has no styles applied to it's text and it creates the bold, italic, bold italic, superscript, subscript or any other character formating into Character Styles!
    It's really fantastic!
    http://indesignsecrets.com/free-scripts-help-fix-word-formatting.php
    Smart Title Case
    You can edit the script easily enough and follow the format to add in your own conjunctions, or to add in your own intentional capital letters.
    The link to download is on the left
    http://jsid.blogspot.ie/2006/06/smart-title-case-revisited.html
    Table Sort
    Does what it says on the tin - it sorts a table, quite nifty!
    http://www.kahrel.plus.com/indesign/tablesort.html
    Data merge into a table
    InDesigns Data Merge is quite powerful but it doesn't allow data merging into a table, say for a table plan of guests or something like that.
    This resolves that issue
    Follow the instructions carefully!
    http://indesignsecrets.com/using-data-merge-to-create-a-table-for-a-directory.php
    Replace Text
    Have to replace your text with Lorem Ipsum for some reason? I requested this script and you follow the thread below
    http://forums.adobe.com/thread/574682
    Stylighter
    Highlights styles within text - I find it handy for if you need multiple people to proof text - but there's bound to better uses than that!
    http://indesignsecrets.com/style-highlighting.php
    Batch Convert
    This is Golden! You can select a folder of InDesign files and choose an output method, from IDML, to Package, to JPEG, to whatever else is mentioned in the conversion options.
    Tips:
    Set your JPEG export options by exporting a sample page first. As you don't get a dialog to choose what JPEG settings you want to choose, it uses the last JPEG setting you choose.
    Setup a PDF export option so it's available to choose if you're batch exporting PDFs.
    Run with no documents open to select a folder. Run with a lot of documents already open and it will use them.
    http://www.kahrel.plus.com/indesign/batch_convert.html
    Finally!
    PageExporterUtility
    It basically lets you select what pages to export to a specific format - it's very handy and easy to use.
    I use it mostly for RTFs as InDesigns RTF export is a bit dodgy.
    (the Batch Convert above for RTFs of multiple files is just pure golden!
    http://www.rrdonnelley.com/prepress/prepare/indesign/indesign-exporter-utility-script.aspx
    That's it
    Hope to hear from the rest of you guys on the scripts that make your life handier while using InDesign!

    Good idea for a thread!
    One script that I use regularly and is very useful is the late Teus de Jong's HyphenationChecker. This displays a complete list of all hyphenated words used in a document so that you can double-check them at a glance. Available here:
    http://www.teusdejong.nl/thome/ho_body5.html#hyphen
    I also must mention a couple of my own freebies, both of which I use regularly. I'll just copy the blurb from my site:
    Quick Apply with Next Style
    Have you always wished that the quick-apply feature would respect your paragraph style’s Next Style setting? Have you always wished that there would be an easy shortcut for Next Style? Well, now there is!
    Case Cycle
    This little script is a great timesaver. It simply cycles through three of InDesign’s capitlization options: All caps, lowercase, sentence case.
    They can both be accessed from this page: http://www.freelancebookdesign.com/scripts

  • Find Replace from Textfile with regex

    Hello.
    I'm wondering if anyone knows about an existing script that does a find/replace by list like the script "FindChangeByList.jsx" that comes with every InDesign installation.
    This consists of tow parts, the script itself with the functionality and a simple textfile where you have simple one-liners capable of find/replace with regex.
    the Textfile:
    //FindChangeList.txt
    //A support file for the InDesign CS4 JavaScript FindChangeByList.jsx
    //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          {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+"}
    grep          {findWhat:"  +"}          {changeTo:" "}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double spaces and replace with single spaces.
    grep          {findWhat:"\r "}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a space And replace with single returns.
    grep          {findWhat:" \r"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a space and replace with single returns.
    grep          {findWhat:"\t\t+"}          {changeTo:"\t"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double tab characters and replace with single tab characters.
    grep          {findWhat:"\r\t"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a tab character and replace with single returns.
    grep          {findWhat:"\t\r"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a tab character and replace with single returns.
    grep          {findWhat:"\r\r+"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double returns and replace with single returns.
    text          {findWhat:" - "}          {changeTo:"^="}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all space-dash-space and replace with an en dash.
    text          {findWhat:"--"}          {changeTo:"^_"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all dash-dash and replace with an em dash.
    The script:
    //FindChangeByList.jsx
    //An InDesign CS5.5 JavaScript
    @@@BUILDINFO@@@ "FindChangeByList.jsx" 3.0.0 15 December 2009
    //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/FindChangeList.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;
    This is a very useful and easy to maintain script which even people who cant write scripts (but know how to use regex) can do complex search replace mass replacements.
    Would love to find something like this for FrameMaker 12 (as i can't write scripts myself).
    regards
    daniel

    I have visited that site. The first item in the external link says: "You can also configure Firefox to automatically search for text when you type any characters outside of a text field. When typing in a text field these characters should show up in the text field and not trigger the Quick Find bar. "
    What I am looking for is the exact opposite. Once my first search is entered in the text box, and the info comes back, I want to start typing the next symbol, and have it automatically show up in the text box, not the Quick Find box. That is how it was working up until a couple of months ago.

  • How do I find/replace italics in a PDF?

    I would like to change all the italics in a PDF to a different font so they will be recognized when I convert the PDF to an InDesign file. Right now they're fake italics of an embedded font so when I convert the file they disappear and turn into regular text. I will be changing the fonts after I convert so I don't necessarily have to keep them an italic font, just something different so I'll be able to change them to italics later. I tried a couple sentences and made them Times New Roman instead of Janson Text 55 Roman and when I converted they stayed as Times New Roman and I was able to make them an italic font. Just wondering if there's a way to search the whole PDF and do a mass find/replace instead of scrolling through the whole novel and changing them manually?
    Any help would be greatly appreciated!

    "... find/replace italics ..."
    Ahh, sorry. You don't.
    (in context of a word processing like activity).
    Doing it manually with the "Edit Text & Images" tool?
    Well, that't keep one out of mischief.
    Be well...
    Message was edited by: CtDave

  • Script for finding characters in a folder or file name

    I need some help on writing a script that will search thru users folders and files and replace characters in the names with a different character. Our users folders go back to when the users used OS 9 and they used / \ * ? in the file and folder names, I want to write a script that will replace these characters with an _ . Obviously I will need to be logged in as the root user.
    The server is OS 10.3.9
    Thanks,
    Jeff
      Mac OS X (10.3.9)  

    Hi Roger,
       There's a flaw in your regular expression and that is the absence of alternation. You want to replace any one of these characters with an underscore. That can be accomplished by putting the characters in a character class. Since the class matches a single character, you'll get an underscore for each.
       Your regular expression only matches a group of all of the characters, side-by-side, in the order you typed them and then it replaces the entire group with a single underscore.
       Oh, there's one other possible flaw. I think that the find utility creates lists of files in relatively large groups and then acts on them. If you change a directory that contains a file you want to change, it's possible that the change to the directory will not be reflected in the path to the file, causing a "file not found" error. A depth first search and acting only on the basename would eliminate that possibility.
    Hi Jeff,
       I recommend a command like the following:
    find -d /Users -regex ".[\:*?]." -exec echo 'mv "{}" "$(dirname "{}")"/"$(basename "{}" | sed '\''s/[\\:*?]/_/g'\'' )"' \; | sh
    That uses the same character class in the -regex option of the find command. That way, nothing will be invoked unless necessary. The method of creating the text of a complex command and using the -exec switch to echo that into a shell is an old trick from O'Reilly's UNIX Power Tools.
       I substituted a colon for a forward slash. As the path separator, the forward slash isn't a valid filename character on a UNIX system. However, old Apple tools, including the Finder, still use a colon as the path separator. Therefore the system presents the allowable character as a forward slash to Apple tools and a colon to UNIX tools. Thus using the colon in the command above will have the effect you want on files that the Finder says has a forward slash in the name.
    Gary
    ~~~~
       James Joyce -- an essentially private man who wished his total
       indifference to public notice to be universally recognized.
             -- Tom Stoppard

  • Script a find/change using a datasource

    So I wrote a program (C#) a few years ago that basically opens an InDesign Exchange file, does a find/replace based on a SQL table datasourse and then our graphics folks would just convert the completed INX file back to InDesign and ultimately to a PDF.  Too many steps.
    There are upwards of 2500 pieces of variable data in each file, so a product like DesignMerge is not practical.  Our data file basically consists of 2 fields [LookFor] and [ReplaceWith], I'd like an Indesign script that will just run through the data file and do a Find/Change for each record.  Is this doable and does anyone have any suggestions or starting points?
    Thanks!

    Yes, it's possible. In my oppinion the easiest approach is to export your data to a csv-file and read it by script. I posted an example in this thread.
    However, on PC, it's also possible to exchange data directly between InDesign and Excel, or Access (without csv). I did some tests: the main (InDesign) part was written in JS. Another (Excel) part that opens a workbook, reads records and closes it was written in VB (it is sent from the main part via doScript method). The VB script reads all used ranges puts, them into a string and returns it back to the JS via ScriptArgs.SetValue method (JS gets the string by app.scriptArgs.getValue method).

  • Address Book - is there find/replace-type functionality available?

    I would like to be able to make a "global" change to multiple existing address book entries in a manner similar to the find/replace functionality found in word processing and spreadsheet-type programs available today.
    Practical examples:
    - Company XYZ gets bought out by company ABC and every contact's email domain must be changed from XYZ.com to ABC.com
    - Company DEF moves to a new business address and every contact's business address needs to be updated
    - Unincorporated zip code 99999 gets annexed by a city gov't requiring a city name change for every 99999 zip code entry
    - and so on.....
    I've found two options that can find (based upon a character string match) but neither option can do a replace based upon the find
    - Spotlight
    - Andreas Amann's Mail Scripts' "Search Addresses"
    I've encountered situations where there have been hundreds of changes needed to my Address Book. It seems I should be able to do this without exporting my Address Book to use an external product to make these changes and then re-import the data. Or am I being unreasonable?
    TIA ---

    Right-click a displayed image and select Save Image to Desktop or Save Image As... from the contextual menu. Dragging to the Desktop or a folder will also work sometimes.

  • Find & Replace window missing in Toolkit CS5

    Hello--
    I just started using Adobe ExtendScript Toolkit CS5 after installing Photoshop CS5, and ran into a strange problem: the Find & Replace menu option and key command do not function correctly, in that I cannot access Find at all.  The Find / Find Results window does not appear, and I cannot get the window to appear by selecting the option in the Windows tool menu either. This works just fine in Toolkit CS4, and is very frustrating to deal with as I am trying to update my scripts to CS5, but have to do so in the CS4 Toolkit because I can't use the Find functionality.
    I've already searched the forums and google high and low for this problem, but no else seems to have posted about it. I've already tried restarting and uninstalling / installing CS5 and all related tools. Can anyone help?
    Thanks!

    Thanks! Looking in the preferences led me to the answer to the problem: I opened up the XML file and found that findAndReplace was put in an odd TabPane for some reason:
            <TabGroup5>
              <activeChild>findAndReplace</activeChild>
              <parentName>Tabpane13</parentName>
              <visible>false</visible>
            </TabGroup5>
    I changed the parentName to Tabpane0 and the window appears now. Much obliged!

  • Bridge CS6 Script to Find Multiple Images in Multiple folders.

    Is it possible to have a script to find multiple images within multiple folders that is on a external hard drive?
    For instances I have a external hard drive assuming it's for a library of pictures.
    Inside this hard drive has folders named as below
    1-1000
    1001-2000
    2001-3000
    3001-4000
    If I had a perfect csv file for example that calls out for specific pictures for example 2, 10,1500 and 2000 (remember think big, it may be a larger list than this it could be hundreds or thousands of pictures); is there a script that would allow me to find these images and save a copy of them on to my desktop so that way I don't have to hunt for them in the old fashion way? I can read scripts but writing them is a different story.

    If you want to go with Batch I would recommend creating an Action of more or less these steps:
    • set the resolution to the same as the background image’s
    • change the image from Background Layer to regular Layer if necessary
    • convert it to a Smart Object
    • add a Drop Shadow Layer Style to the image (do not use Global Angle)
    • place the background image (File > Place …)
    • move it behind the image layer
    • Image > Reveal All
    • make Selection from that layer’s transparency (cmd-click its icon in the Layers Panel) and use Image > Crop
    • select and transform the image layer to fit the intended position
    This would naturally work out best if the images had the same size and proportions.
    For the reflection on the floor duplicate the image, flip it vertically, move it in position and reduce its opacity to maybe 10%.
    Realistically you may have to hide it partially behind the pillows, a Vector Mask would be an option.

  • How to find & replace in Javascript code?

    Hi all!
    I hope that this turns out to be an easy question! We recently updated several forms (about 50 of them) to alter a select set of field names per customer requirements. However, it turns out that one of these fields is a key field and is referenced in one or more places by JavaScript within the PDF.
    In Acrobat 6 I'd select the option to edit all scripts which would give me a big document with all of the Javascript within the PDF. I could then do a find/replace on the code and save it. Now, using Acrobat Pro 9, I cannot find anything like this. Please don't tell me that I have to search through all of the different form fields and PDF objects to find all of the script pieces tied to objects or events! I'm really, really hoping that there is an easier way to do this since right now I'm out of ideas and really don't want to have to sift through all of the objects in over 50 PDF documents.
    Thanks in advance for pointing me in the right direction!

    Talk about not being able to see the forest for all the trees! I can't believe that I missed that -- I spent quite a while looking all over before posting. *sigh*
    The exact menu sequence (for those interested) is Advanced -> Document Processing -> Edit All JavaScripts...  That is exactly what I needed. Thanks!!!

Maybe you are looking for

  • Posting Error In F-53

    Dear All, When i do outgoing payment in F-53 Forgien currency  USD the system is showing following errors Posting is only possible with a zero balance; correct document & Incorrect automatic postings are cancelled. And i have checked OBA1 - Forgien c

  • Can't switch from old Blackberry 8703e to new 8530

    I installed the Blackberry Desktop Software.  I connected the 8703e and the 8530 and tried to switch.  The 8530 will shut off during the switch process.  Then I get a fatal error from the BDS.  Any ideas as to what I'm doing wrong.  Is it because one

  • Bookmark missing after updating to Firefox 31

    Hi there! All my book marks & history setting are gone when I did my update to Firefox 31. Tried to restore from the auto bookmark backup but is prompt with "Unable to process the backup file." Tried downloading the Place Maintenance as suggested but

  • Radius Passowrd error

    I am having the following issue with authentication to MS IAS. I get connected to the ASA no problem. I then get asked for my credentials, and I add my domain user and password. I receive unknown username or password error in the event log of the Rad

  • Has anybody with positive experience Safari on VISTA?

    Can someone with experience tell me if Safari is better than the Windows Internet Explorer-7 on VISTA. My Apple software keek prompting me to install Safari 3.1 on my windows vista. In another forum, on opinion was that safari VISTA has a risk of una