How do I make a script to find/change many in one go

I have a long list of words that I do a find/change to avoid breaks and keep with the next word. Words like Dr. Mr. Mrs. :
Is there an easy way to put all the words and symbols that I want to change into one script to save doing each one at a time?

1) Free solution: FindChangeByList.jsx
(in \Scripts\Scripts Panel\Samples\JavaScript)
2) Better and very flexible solution: Multi-Find/Change
http://www.automatication.com/index.php?id=12
@+
Marc

Similar Messages

  • How can I make a long list find-change only on Master

    Hi everyone
    I got this script:
    var myDocuments = app.documents.everyItem();
    var myLayers = myDocuments.layers.everyItem();
    //Locked text frames on master spreads are not touched.
    //If you want to unlock them you have to add something like this:
    //Unlock ALL page items in every document on spreads and master spreads (optional):
    myDocuments.pageItems.everyItem().locked = false;
    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
    //Unlock the layers (optional)
    myLayers.locked = false;
    //Lock all first level page items on normal spreads
    //That leaves the page items on master spreads unlocked:
    myPageItemsOnNormalSpreads.locked = true;
    //Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "\\b20\\d+\\b";
    //Do the search on "all open document" level
    //That will return an array of arrays:
    var myTarget = myDocuments.findGrep();
    //Flattening the myTarget array:
    var flattenedFoundArray = [];
    for(var n=0;n<myTarget.length;n++){
        flattenedFoundArray = flattenedFoundArray.concat(myTarget[n]);
    //Change contents of found texts in flattened array:
    for(var n=flattenedFoundArray.length-1;n>=0;n--){
        flattenedFoundArray[n].contents = String(Number(flattenedFoundArray[n].contents) + 1);
    //Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;
    //Reset GREP find and change prefs:
    app.findGrepPreferences = changeGrepPreferences = null;
    made by Uwe
    I change it into this, aim to make a mulit items of find-change only on master
    //==============================================================================
    var myDocuments = app.documents.everyItem();
    var myLayers = myDocuments.layers.everyItem();
    //Locked text frames on master spreads are not touched.
    //If you want to unlock them you have to add something like this:
    //Unlock ALL page items in every document on spreads and master spreads (optional):
    myDocuments.pageItems.everyItem().locked = false;
    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
    //Unlock the layers (optional)
    myLayers.locked = false;
    //Lock all first level page items on normal spreads
    //That leaves the page items on master spreads unlocked:
    myPageItemsOnNormalSpreads.locked = true;
    //Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "USA";
    //Do the search on "all open document" level
    //That will return an array of arrays:
    var myTarget = myDocuments.findGrep();
    //Flattening the myTarget array:
    var flattenedFoundArray = [];
    for(var n=0;n<myTarget.length;n++){
        flattenedFoundArray = flattenedFoundArray.concat(myTarget[n]);
    //Change contents of found texts in flattened array:
    for(var n=flattenedFoundArray.length-1;n>=0;n--){
        flattenedFoundArray[n].contents = "CHINA";
    //Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;
    //Reset GREP find and change prefs:
    app.findGrepPreferences = changeGrepPreferences = null;
    var myDocuments = app.documents.everyItem();
    var myLayers = myDocuments.layers.everyItem();
    //Locked text frames on master spreads are not touched.
    //If you want to unlock them you have to add something like this:
    //Unlock ALL page items in every document on spreads and master spreads (optional):
    myDocuments.pageItems.everyItem().locked = false;
    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
    //Unlock the layers (optional)
    myLayers.locked = false;
    //Lock all first level page items on normal spreads
    //That leaves the page items on master spreads unlocked:
    myPageItemsOnNormalSpreads.locked = true;
    //Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "Washington DC";
    //Do the search on "all open document" level
    //That will return an array of arrays:
    var myTarget = myDocuments.findGrep();
    //Flattening the myTarget array:
    var flattenedFoundArray = [];
    for(var n=0;n<myTarget.length;n++){
        flattenedFoundArray = flattenedFoundArray.concat(myTarget[n]);
    //Change contents of found texts in flattened array:
    for(var n=flattenedFoundArray.length-1;n>=0;n--){
        flattenedFoundArray[n].contents = "Beijing";
    //Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;
    //Reset GREP find and change prefs:
    app.findGrepPreferences = changeGrepPreferences = null;
    //===============================================================================
    only what I can do is repeat and repeat again
    is that another perfect solution to do that?
    thanks
    Teetan

    Try this,
    findChange("USA", "CHINA");
    findChange("Washington DC", "Beijing");
    function findChange (findWhat, changeContent){
        var myDocuments = app.documents.everyItem();
        var myLayers = myDocuments.layers.everyItem();
        //Locked text frames on master spreads are not touched.
        //If you want to unlock them you have to add something like this:
        //Unlock ALL page items in every document on spreads and master spreads (optional):
        myDocuments.pageItems.everyItem().locked = false;
        var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
        //Unlock the layers (optional)
        myLayers.locked = false;
        //Lock all first level page items on normal spreads
        //That leaves the page items on master spreads unlocked:
        myPageItemsOnNormalSpreads.locked = true;
        //Now for the GREP part:
        app.findChangeGrepOptions.includeMasterPages = true;
        app.findGrepPreferences = changeGrepPreferences = null;
        if(findWhat)app.findGrepPreferences.findWhat = findWhat;
        //Do the search on "all open document" level
        //That will return an array of arrays:
        var myTarget = myDocuments.findGrep();
        //Flattening the myTarget array:
        var flattenedFoundArray = [];
        for(var n=0;n<myTarget.length;n++){
            flattenedFoundArray = flattenedFoundArray.concat(myTarget[n]);
        //Change contents of found texts in flattened array:
        for(var n=flattenedFoundArray.length-1;n>=0;n--){
            if(changeContent)flattenedFoundArray[n].contents = changeContent;
        //Unlock all objects on normal spreads:
        myPageItemsOnNormalSpreads.locked = false;
        //Reset GREP find and change prefs:
        app.findGrepPreferences = changeGrepPreferences = null;
    Vandy

  • How to make a script for find text object?

    Hi everyone
    I want to make a script for find and select text object and then find next, find next, and so on, but without any open dialog
    Is that possible make a script for this?
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "(\[\x{2022}\])|(\x{25CF})";
    app.findGrep();
    thanks
    Regard

    You already have that. A script does not 'find, select, find next' - it finds all texts as soon as you execute the 'app.findGrep' command.

  • When pressing Ctrl+f to find something in a page the Find box remains open until I close it, in ALL tabs I have in the firefox window. How can I make firefox open the Find box ONLY in the tab I am in?

    When pressing Ctrl+f to find something in a page the Find box remains open until I close it, in ALL tabs I have in the firefox window. How can I make firefox open the Find box ONLY in the tab I am in?

    Firefox 4 and later versions save the previous session automatically, so there is no longer need for the dialog asking if you want to save the current session.<br />
    Use "File > Exit" or "Firefox > Exit" (Mac: "Firefox > Quit Firefox") if you want to restore multiple windows.<br />
    You can use "History > Restore Previous Session" to get the previous session at any time.<br />
    You may need to click the orange/gray Firefox button to see History.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.
    Another possibility is to use:
    * [http://kb.mozillazine.org/Menu_differences Firefox/Tools > Options] > General > Startup: "When Firefox Starts": "Show my windows and tabs from last time"

  • HT1364 I have moved my library to an external hard drive and changed the location of the iTunes media folder in Preferences, but every time I close and re-open iTunes, I have to do it all over again.  How can I make the iTunes media folder change permanen

    I have moved my library to an external hard drive and changed the location of the iTunes media folder in Preferences, but every time I close and re-open iTunes, I have to do it all over again.  How can I make the iTunes media folder change permanent?  I have an older machine with Windows XP.

    I don't believe mounting the hard drive should be necessary, unless you have several external drives and want your computer to recognise them as folders, rather than drives. I've never had to mount a hard drive, ever. If you don't know how to do it, then it shouldn't be necessary now.
    Try this:
    Prepare iTunes so that it can see the external drive.
    Make a note of which drive-letter the external drive has been allocated. (Look in Windows Exploer)
    Look at the file location for a song. Make sure it plays (and therefore that iTunes has found it). Highlight it and select File/Get Info/Summary>Where: and make a note of the drive letter for that song.
    Close and shut down the computer.
    The next time you turn the computer on again, connect the external drive
    Before you start iTunes - check the external drive in Windows Explorer. Is it ready, does it have the same drive-letter that it had last time? Can you go into the drive and see the files on it?
    Once you can, start iTunes. (If the drive lettter has changed, you need to work out why before going any further.)
    If iTunes fails to find your external drive, you need to check where iTunes is looking for your Library.
    Select the same song you checked before (presumably iTunes can no longer find it). Follow the procedure for locating it. You should be able to see where iTunes thinks the file is. It's the drive that counts. Which drive letter is iTunes looking at? Is it the same one that it was previously (which should also be the same one that the drive has now).
    What happens, which step do you have problems with?
    Message was edited by: the fiend

  • How do I make image icons in finder window previews of the image?

    The image icons in my finder window are just generic jpeg icons (they are set to open automatically in Preview). How do I make them previews of the images themselves? When I "get info" on the icon, there is a very nice preview of the image - I would like to see the same quality preview in the icons themselves.
    Thank you very much for your help.
    Sam
    Powerbook   Mac OS X (10.4.6)  

    Hi Sam,
    From your Finder "View" menu (without a Finder window open) >> "Show view options" >> do you have "show icon preview" check marked? And with the Finder window open "show icons" and "show preview icons" checkmarked?
    EDIT: I may have misunderstood your question. If you're talking about the small file icons, not in the preview frame if you have PhotoShop it should do it with a save as PS file. Otherwise you may be able to paste the image but I'm not sure.
    -mj
    [email protected]
    Message was edited by: macjack

  • Newbie Question...  How do you make sure java can find all the imports

    Hi everyone,
    I am new to Java and so far I really like it. But I am having problems porting applets to my websites. How can you make sure that all the references can and will be found in the applet...
    for example,
    I import javax.media.ControllListener in a project I am using and it works great in the applet viewer but when I try to port this to my website I'm working on, java can't find it. I really would appreciate any help on this cause then I would have java power :) and will keep me from losing my hair :).
    Thanks for those who help me.
    - Stan

    Hey jwenting,
    Thanks for the quick response. Classpath definitely makes sense so I have been reading up on that... But do you include .classpath file in your website too? And how would you reference it if you need to reference it?
    - Stan

  • Not sure if Mavericks is worth the effort of downloading and I prefer mountain lion.  How do you make a file in Finder.

    I am not sure if Mavericks is much better than Mountain Lion as an OS.  The maps part was okay but I could not view the map as shown on the apple website, there was no 3D.  How do you create a file in Finder on the MacBook Pro.?

    Duuuuuuuuuuuuuuuuuuuuuuuude!!!!!!!!!!!!  YOU DID IT!  I cannot believe it!
    I changed "Move To Trash" to "Move to Trash" and selected a file.  I had lost all hope, so I took a minute to prepare myself for yet another moment of deep frustration.  Then I pressed F10, and bang! the file was trashed!!!  It took me a couple minutes to actually believe what just happened.  Thank you so much!  If I could, I would "like" you as many times as I can physically hit the "Liked" button!
    PS: what the heck is wrong with Apple though???  Wrong instructions, incorrect help instructions on their own site.  The chances of figuring this out before having a nervous breakdown were like one in a million (approximately, I did not actually do the math).  Last week, the keyboard and the trackpad stopped responding on my brand new macbook pro for a couple hours. I was not the only one with this problem.  Apparently, this was from a design flaw, which means it could happen again at any time.  iMovie doesn't work.  TextEdit keeps crashing all the time.  Emptying the trash can take hours. 
    Since 2000, I bought a PMac G4 Quicksilver, a used PMac G3 Blue, a used iBook G4, a used Pismo PBook G3, a used Graphite iMac G4, a used iMac G3 (green, 233MHz I think) and I already had more problems with this brand new macbook pro than will all the other macs combined...  For such an expensive machine, with 16GB of RAM, that's a little dissapointing, especially from Apple.  Maybe I'm just not lucky.
    Anyways, thanks again!  Best moment of 2014!

  • 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 do you make all outgoing mail on iPhone come from one default address?

    I have multiple Apple devices which include laptop, iPad, iPhone 4, iPhone 4s.  I use several email accounts for my business.  How do you make the default outgoing email address one the iPhones one email address like you can on the laptop?  I want the outgoing email address to be the same on all devices.

    Thank you.  I think I got it for the 4 but not for the 4S.  In mail, contacts, calendars, do you choose default account?  Also, there does not appear to be a choice like this for the icloud.  How do you change the default on it?  The best I can see is icloud to account to advanced to mail to icloud account information.  On that screen there is a box that says allow sending from and the only choices you have are the icloud account and me account.  I do not see how to add another account if that is the right section.  I don't want the icloud or the me to be a return address.
    Thanks in advance.

  • 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).

  • How do I make a "yes" or "no" radio button in one page, and "mirror" the two to another page?

    Hello,
    How do I make the radio button in page 10 mirror the choice made at page 3? Thank you.
    Page 3:
    Page 10:

    Simply copy the fields from one page and paste them in the other. Just make
    sure you tick the option that says "Buttons with the same name and choice
    are selected in unison" under the field's Properties, Options tab.

  • How do I make this script: Hide dock while Gimp is open, automatically?

    Scenario: I need to maximize my 1024x768 screen when I do photo editing, so every time I open Gimp.app, I hide my dock. Since I tend to re-arrange icons on my dock periodically, I generally like to leave it showing. When I quit Gimp.app, I sometimes forget to un-hide the dock and am annoyed later on when I can't easily see the icons.
    Goal: This may seem trivial, but it would be nice to make a small application that does the following:
    1) Either launch Gimp.app, or simply link something to Gimp.app that launches my home-made application concurrently.
    2) Hides the Dock when Gimp.app launches.
    3) Runs in the background, ideally not visibly, and not using more than 4 or 5 MB of RAM or generating any processor load, and observes when I either quit Gimp.app or quit X11.
    4) Shows the dock and terminates itself when I Gimp.app closes.
    If I use this as a launcher, I could give it a Gimp icon and put it in the Dock instead of Gimp. If it is activated by Gimp, the other option I mentioned in #1, the icon would not be significant because hiding mode will be turned on every time my home-made app is open.
    I see several potential solutions but can't iron out the details. I have searched Google and these forums, and found solutions to a few similar problems, but have not been able to adapt those solutions to my needs. If this could be handled better with something other than AppleScript, feel free to point it out. The ideas I have for doing this are:
    1) Write an AppleScript
    2) Set this up in Automator
    3) Save a Unix shell script, or
    4) Write a simple Java application.
    I think using Java would make this unnecessarily complicated, because #1, #2, and #3 can all handle system events quite well, that's not really what Java was meant to do. It may still be an option, though. I have generated a few working parts of the program in #1 and #2, but I the only waiting command I could find waits for the user to click in a dialogue box, not to quit an application.
    I hope this isn't too much of a newbie question, I've done a lot with Macs before, and this ought to be simple but I'm stumped. I've never needed to post on a Mac forum, but you can find me all over the Linux forums, since that isn't my forte! Help will be greatly appreciated.

    Save the code, provided below, as an applications (AppleScript applet, via the 'File Format:' popup menu), and click on the 'Options:' 'Stay Open' checkbox to add a check mark.
    -- Code starts here --
    property tApp : "Gimp"
    on run {}
    tell application "System Events" to tell process "Dock" to keystroke "d" using command down & option down
    tell application tApp to activate
    end run
    on idle {}
    tell application "System Events"
    set pNames to name of processes
    tell process "Dock" to if (not (pNames contains tApp)) then
    keystroke "d" using command down & option down
    tell me to quit
    end if
    end tell
    return 2
    end idle
    -- Code ends here --

  • How do you make a folder in finder?

    Hi I was wondering how you make a folder to put documents into on finder. I would be greatful for your help thank you

    see image below - click on file - then click on new folder.

  • How do I make a script "Run as administrator" on its own?

    Hello,
    Win 8.1, VB scripts or PowerShell
    Having discovered I previously failed to fully study UAC, I now understand why scripts transferred to a new Win 8.1 machine quit working.  They have to be 'Run As Administrator' on the new machine; then they work as before.  While I'm still
    a little hazy on UAC, but continuing to study, it seems I'm left with a choice.  Please correct my perception of this choice if it's wrong:
    1) I can change my UAC settings (which I actually prefer not to do - I'm a safety guy...)
    2) I must always run my scripts by right clicking to the context menu and clicking "Run As Administrator"
    3) I learn if there is a way for my script to "Run As Administrator" on its own
    Assuming my choices above are correct, I would like to focus on choice 3.
    I've done some amount of research, but I'm not sure any of the solutions I saw actually accomplish choice 3.  Most of those posts indicate that the individual still had to enter a password or perform some other interaction after the script ran, so I'm
    not sure why the solutions posted were an answer to what was basically the same as my question here.
    Can a script be setup to Run As Administrator without requiring any further user interaction?  I'm wondering if this is actually a self-defeating question, because if a script can be setup as such, then wouldn't it bypass the very purpose
    UAC was put in place, for protection?  Am I thinking incorrectly?
    If it is possible to write the script so it really runs without further interaction, please point me where I might need to study more.
    Thanks.
    Best Regards,
    Alan

    Hi jrv,
    So, I think we've unofficially become friends since you answered my question in .vbs because you know that's where I've been.  I really am trying to transition to .ps1, but thanks for the thought. :-)  I actually did write a test .ps1 using get-vm
    (which is very cool thank you) but wasn't able to execute it other than running a batch file from the context menu selection 'Run As Administrator'.  The following is the operative line I used in the batch file (it doesn't seem like the -Verb runas
    worked as I expected it to):
    powershell -executionpolicy remotesigned -file C:\batchFiles\ps\vmstatus.ps1 -Verb runas
    I am getting a book on Powershell to study.
    But, regarding your line above, I think I applied your guidance correctly.  I created a shortcut with the following line in the target box (I'm assuming this is what you were directing me to do. I also assumed I was supposed to add powershell.exe
    at the beginning of the line you posted above):
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    start-process cscript C:\batchFiles\vmStatus.vbs -Verb RunAs
    Windows seem to add the full path for powershell.exe automatically.  It runs without requiring the context menu selection "Run As Administrator", but it
    still brings up the UAC message box for permission to continue, which is what I was trying to address in my initial post when I was speaking to the possible self-defeating nature of my question to allow
    a script to bypass UAC.
    I'm asking to confirm: having the UAC popup is in fact normal behavior that can't be side stepped unless other steps are taken.  So I guess I need to continue research to understand
    what must be done to allow simple double-clicking of a shortcut to get a seamless execution without actually changing UAC.
    Regarding STscripter's solution, I experienced the same UAC message box, so this post is also in response to that answer.
    Thanks again for your help.
    Best Regards,
    Alan

Maybe you are looking for

  • Not correct Network schema status [Tcode CN21]

    Hi experts, I am having a problem with transaction CN21: I have to create a network with custom profile, so i follow these steps: 1. lanch Tcode CN21 2. set details of network and WBS 3. Clicking on the green symbol with wich I can select tasks I ins

  • How do I add a trendline

    I have 2 rows of data, both plotted into a 2d stacked column chart. I want to have a trendline appear on the chart, the manual says to select a series of data, but the data I want trended is already plotted and "trendline" is greyed out in the inspec

  • After HD crash, restoring to new HD. Library files missing or corrupt. How can I get iTunes 10 to see my music

    The hard drive on my fairly new HP Pavilion desktop died hard on boot-up. HP replaced the drive the next day.  Used the Recovery Disks and got the unit up and running. I have been using Memeo Premium Backup and never did get any error messages during

  • Profit Center wise Customer Clearing

    Dear Sir, There is our client requirement to have profit center wise customer clearing. Kindly suggest. With Regards, Saurabh

  • Select from 1 table only if a value does not exist

    Hello all, I'm having problems devising a single select statement to accomplish a single return value. I have tried variations of DECODE and COALESCE, but it's escaping me. I have two tables that are as follows: NAME ID, FULLNAME 1, Senior 2, Junior