JS for Find/Change

I am a novice with JS, but trying to make a couple of enhancements to workflow using scripting. I have managed to figure most things out ok, but usually just need a little kickstart. What I am trying to do is:
InDesign CS2
Find a specific sequence of characters in a text selection (in this case, " - " (that is space dash space) and replace with end of nested style & forced line break (^h^n). At the same time, search for double carriage returns and change to single carriage returns (^p^p => ^p).
Currently, using the Find/Change Function from the Edit menu but I'd like to be able to just apply a script to do it all. I have tried to dig through the archives for a similar posting, but haven't had a lot of luck. If anyone can please point me in the right direction, it would most certainly be greatly appreciated!
Thank you in advance.
-Scott

Thank you Peter ... I have just purchased the electronic version of the O'Reilly book that you recommend. This will certainly help.
One thing that is not clear ... can I use characters such as "^p" or "^h" directly when setting my parameters, or is there a unicode equivalent that I would need to use?
Thanks again.
-Scott

Similar Messages

  • TIP: Clean slate for find/change

    Hi,
    Sharing a little tip I just thought of. Very straightforward and
    obvious, but quite useful, and I haven't noticed it mentioned elsewhere.
    If you're doing a lot of find/replace, you'll repeatedly need to remove
    all selections and start with a clean slate (nothing in the find/replace
    fields, clear all formatting).
    It seemed to me for a while that we're missing a "Clear All" button in
    the find/replace box.
    So the answer is simple: clear everything, all options, etc., and save
    it as a find/replace query.
    Now whenever you need a clean slate for find/save, just select that query.
    It's working nicely for me!
    Happy new year,
    Ariel

    I was going to stay out of this, but find I can't. Sometimes it seems to me that scripters see everything as being better solved through scripting.
    I actually think Ariel's observation about saving a blank query is quite brilliant, and I have to agree that there are times, and plenty of users like me who don't use a KB hortcut to access find change, where users will find having the saved blank query much faster than any other method of clearing the dialog. Both methods have their place, but I find it disingenuous to say that Jongware's scriptlet "solves" the case where you want to keep the old values -- it actually complicates things as you then must remember if you are to run the KB shortcut, or use the menu, to acieve the desired result.
    I think it would be far better to say that this, like many things in ID, can be accomplished in more than one way, and that they way you do it may be different at different times, and that the mehod of choice is exactly that, a choice subject to the user's own preference.

  • GREP code for find/change

    Hi everyone,
    I have a list of about 500 entries, with each entry being formatted as follows:
    Firstname [tab] Lastname [tab] State [tab] Level
    I need to perform a find/change operation using some GREP code that will target the tab between the first and last name and replace it with a space. Then I need to target the tab between the last name and the state and replace it with a comma and a space. Then finally I need to target the tab between the state and level and also replace it with a comma and space.
    I wondered if someone could tell me what the code would be for this type of operation?
    Appreciate any assistance.

    You can also do it in a single search:
    Find
    (.+?)\t(.+?)\t(.+?)\t
    Replace
    $1 $2, $3,
    (there's a space after the $3,)

  • Help for find/change glyphs script

    Hi everyone!
    I need help for creating a script (or modifying existing script) that should replace every Cyrillic character  from an old ASCII font with the same Cyrillic character but from new Unicode font.
    For example: Capital letter 'A' GID=107 from old font (Lazurski) should be replaced with 'A' GID=630 from new one (Myriad Pro).
    I can do this by using Indesign Find/Change - Glyphs, but this will take me too much time.
    So, I need a scrip for this job.
    My first attempt was to use the FindChangeByList script by modifying the FindChangelist.txt document, but without success.
    Here is what I've used until now:
    1)  glyph {glyphID:107, appliedFont:"Lazurski"} {glyphID:630, appliedFont:"Myriad Pro"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
    2)  glyph {findWhat:"u00C0", appliedFont:"Lazurski", fontStyle:"Bold"} {changeTo:"0410", appliedFont:"Myriad Pro", fontStyle:"Bold"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find ASCII A replace with Unicode A.
    Both lines didn't change anything. What is wrong?
    Any help is welcome!
    Regards,
    Veselin
    P.S. Indesign CS5

    Thank you Jongware!
    The codes (both ID and Unicode) are correct for sure, but even with correct notation (obviously my was wrong) the script don't change anything.
    Here is the line in the FindChangeList:
    text {findWhat:"\u00C0", appliedFont:"Lazurski", fontStyle:"Bold"} {changeTo:"\u0410", appliedFont:"Myriad Pro", fontStyle:"Bold"} {caseSensitive:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find ASCII A replace with Unicode A.
    Update:
    Finally, I found what is wrong with the script - the properties "caseSensitive:false".
    By removing that properties the script works fine.
    So, I successfully converted a book with old ASCII Cyrillic font to Unicode Opentype font.

  • GREP query for find/change operation

    Hi everyone,
    In the following line, there's a comma after the first name. This type of formatting is repeated hundreds of times on a number of pages so I need to use a GREP find/change query to remove the comma after the first name and replace it with a space.
    Firstname,Lastname,State
    I wondered if something could tell me what the GREP code would be?
    Appreciate any assistance.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    ..  it's also doing it for the second comma
    That's impossible. You must have entered something else than Scott's code.

  • 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 HELP

    Hi,
    Anyone know the code for find/change command on text for specific pages?
    Example: I want to change some text from page 20 to 40 -
    Please help

    There is no such code.
    You can select all the text you want and apply your changes to "Selection" only. (Of course you can only select contiguous text -- that is, all of the text frames should belong to a single running story.)

  • How to find Change number for a Material

    Hi,
    If we know the material number and Revision level then how can we find the Change Number of that material.
    Is there any table in which i can find Change number for a revision level or is there any Function module available.
    Regards,
    Vaibhav

    Hi Vaibhav,
    Is there any table to find the change number and revision level of a material. I have change number and material and revision level coming from external system. But i need to check that with SAP whether it exists or not.
    Is there any table link to find whether a material has change number.

  • "Tag for status change alerts" - how to find out if someone has tagged you

    Dear all,
    On the "Tag for status change alerts" functionality, I was wondering if there is a way to find out if someone has tagged you for change alerts. Please let me know if I can find this out directly or by using an available tool / plugin. I am an user
    and do not have access to the lync server.
    Thanks in advance

    Doulouz is right. It is not possible to check that.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Can you use Find/Change to search for many different words at once?

    I have an 80 page catalogue in Indesign (CS5) - it has several thousands of catalogue numbers listed as text within it. I've just been given a list of 1000 catalogue numbers to search for and if they appear, remove them - is there any way to search for them all in one go, rather than one by one?
    I've started using Find/Change to search for the catalogue numbers but seem to only be able to search one catalogue number at a time that way.
    Any ideas welcome!
    Thanks

    GREP can search for more than one phrase "at once" (i.e., in one operation), like this:
    word1|word2|word3
    -- the pipe | delimits the separate words. Then again, GREP Is Not Magic™. This --
    ...  a list of 1000 catalogue numbers to search for ...
    is a bit too much to copy-and-paste into the single Find What line. There is a limit of ten or twelve (or something) OR phrases you can use in GREP.
    On the other hand: GREP is great at finding numbers. If all of your catalogue numbers obey some basic rule, for instance "all of them consist of 6 digits and there are no other numbers with exactly 6 digits", well, that we can probably work with.

  • Need help for finding objects impacted by size change for an infoobject

    hi all,
    need help for finding objects impacted by size change
    for xxx infoobject, due to some requirements, the size to be changed from
    char(4) to char(10), in the source database tables as well as adjustment
    to be done in BI side.
    this infoobject xxx is nav attribute of YYY as well as for WWW
    infoobjects. and xxx is loaded from infopkg for www infoobject load.
    now that i have to prepare an impact analysis doc for BI side.
    pls help me with what all could be impacted and what to be done as a
    solution to implement the size change.
    FYI:
    where used list for xxx infoobject - relveals these object types :
    infocubes,
    infosources,
    tranfer rules,
    DSO.
    attribute of characteristic,
    nav attribute,
    ref infoobject,
    in queries,
    in variables

    Hi Swetha,
    You will have to manually make the table adjustments in all the systems using SE14 trans since the changes done using SE14 cannot be collected in any TR.
    How to adjust tables :
    Enter the table name in SE14. For ex for any Z master data(Say ZABCD), master data table name would be /BIC/PZABCD, text table would be /BIC/TZABCD. Similarly any DSO(say ZXYZ) table name would be /BIC/AZXYZ00 etc.
    Just enter the table name in SE14 trans --> Edit --> Select the radio button "Save Data" --> Click on Activate & adjust database table.
    NOTE : Be very careful in using SE14 trans since there is possibility that the backend table could be deleted.
    How to collect the changes in TR:
    You can collect only the changes made to the IO --> When you activate, it will ask you for the TR --> Enter the correct package name & create a new TR. If it doesn't prompt you for TR, just goto Extras --> Write transport request from the IO properties Menu screen. Once these IO changes are moved successfully, then the above proceduce can be followed using SE14 trans.
    Hope it helps!
    Regards,
    Pavan

  • Script for running multiple find/change queries

    Working on a large ID book document (*.indb), I have saved several dozens of Find/Change Queries (named "col01", "col02" etc.) that I run on "All documents". For a particular reason I have to run these queries several times a day.
    So I was wondering whether there is, or whether anybody out there would write, a script that runs these queries one after the other. Given the size of the book, it might be necessary to provide for the script to pause after each query is run (before it goes on with the next), but I am just guessing.
    Any help is much appreciated!

    There are a couple of others:
    http://forums.adobe.com/message/5173943#5173943
    this is more at code level rather than a GUI, but the actual queries are made using the Find/Change dialog box.
    Also
    http://www.kahrel.plus.com/indesign/grep_query_manager.html
    This is good too, but only does GREP searches (no text, glyph or object find/replaces) that were written by the user - does not use the ones installed with InDesign. Does allow changes by selection, story, document or folder.
    Did try the Doquerylist suggested by Kasyan. This allows GREP/text changes by the user/installed with InDesign, but only applies to a selection or text-thread.
    Always good to have more than one way of accomplishing a task though!

  • Find/Change for internet links?

    Is it possible to do a Find/Change for internet links?
    That is, if I have URLs that do not appear in the text of the AppleWorks document, but in the links window, and I want to change all the links beginning with http://us.imdb.com to http://pro.imdb.com
    It seems this is not possible through the Find/Change function under the Edit menu, but perhaps I just don't know the right way. Otherwise, the only way to do it would seem to be to change each one individually in the links window with the edit function.

    Hello
    Alas, the last formula is the right one.
    The URLs are not stored in the body of the document so the Find/Change tool is unable to find them.
    Yvan KOENIG (from FRANCE 17 octobre 2005 21:51:08)

  • Change keyboard shortcut for "Find"

    The default keyboard shortcut for the "find" function is Cmd-Opt-F. As you know, for virtually every other Mac app (if not all Mac apps), the shortcut for "find" is simply Cmd-F. In iTunes, though, Cmd-F turns the visualiser full-screen mode on and off. I never use the visualiser, and decades of Mac use have hard-wired my fingers for Cmd-F to be "find." I know that there is a method in System Preferences by which to change or assign associations between drop-down menu items and keyboard shortcuts, but there is no menu item for "find" so that method seems like a dead end.
    Is there a way to replace Cmd-Opt-F with Cmd-F in iTunes?
    Help, please!!!

    to be quite honest i dont no how exactly to do this,
    i just know it can be done. i have had no problem
    opening .plist files in vi-make sure you are in root
    account for system files.
    They (the .plist files) don't seem particularly readable in vi -- they seem to contain a lot of binary content. In earlier versions of OS X they were plain text and easily edited.....
    Solaris huh? how powerful
    is that? i dont know much about solaris . . . . like
    to try it though. recommendations?
    It's a more "traditional" Unix, meaning that it's very powerful, fairly bulletproof, very configurable, and pretty obtuse if you're not familiar with it. I like my Mac better!

  • Find Change through external text file

    Hello folks
    I am bit pretty in InDesign scripting so could you please look into this.
    How can i change any particular text field in Indesign CS3 document from text file.
    I do have find change script but for each InDesign document specific text file is assigned.
    So each time i have to modify find change GREP property that is also repetetive of work. Is there any way to get find change information should be extract from external text file.
    Many Tanks in advance

    In the FindChangeByList script, you could customize the function myFindFile(myFilePath) {...} as to search the FindChangeList text file in the document location rather than the script location. That's an example. The question is: given a document, where will you have the corresponding FindChangeList?
    @+
    Marc

Maybe you are looking for

  • Good documentation

    I have a subscription for Office 365 and am using Project Pro for Office365 as well as Project Online.  I know how to use project when storing project locally. I am struggling with understanding and managing projects through office365 and integrating

  • Detail Info Pop Up

    Hi I saw an article a week or two ago about a cool example of having a hover over icon which when clicked showed some detail info in another cell somewhere on the page. I read it and though "Hmm, thats nice" and forgot about it but now I have the nee

  • Problem mit Textfeld in der Mustervorlage

    Hallo Leute! das Problem ist folgendes: Wenn ich in der Mustervorlage eine Textbox erstelle, kann ich auch nur Text in die Mustervorlage setzen. Ich möchte aber auf den Seiten verschiedene Texte einfügen ohne jedesmal pro Seite eine neue Textbox zu e

  • How to embed JMF registry in web browser?

    is it possible to run JMF registry functionality to detect the webcam through the web browser/applet so that anybody in a network use a webcam to capture the image

  • PID temperature control through voltage, Amperes and thermocouple as sensor

    here is the Hardware setup of mine.  [IMG]http://i34.tinypic.com/daa8.jpg[/IMG] Now, I already have such a VI which gives me the temperature of heater. But i want to control the temperature of the Heater from VI, in which when i give certian temperat