[JS CS3] How to load Find/Change dialog?

Hello,
Below is a script that uses GREP to find straight apostrophies and then change them to smart (curly) ones. The script invokes the Find/Change dialog so that the user can see what she or he is doing.
However, if the user last used the Find/Change dialog in the TEXT mode, that is the mode that appears. I want the script to go to the GREP mode. I see that there is code for app.loadFindChangeQuery(queryName, searchMode), but I have no idea what the "queryName" is and how to use it in this script.
Thanks for any help.
Tom
theGrepLoader("~'", "~]");
function theGrepLoader(grepFindIt, grepChangeIt){
    app.findGrepPreferences = NothingEnum.NOTHING;
    app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = grepFindIt;
    app.changeGrepPreferences.changeTo = grepChangeIt;
    app.menuActions.item("Find/Change...").invoke();
}//end theGrepLoader

Thanks, Peter!
I appreciate your help but I have found another solution. I am amazed at my own stupidity sometimes. You see, I do my scripting in a very lame sort of way because I have never used Javascript outside of InDesign. As such, I find myself at a disadvantage because the documentation that Adobe provides assumes that you are aware of many of the basics. Case in point: I have always had trouble manipulating strings because I NEVER KNEW that you could search and replace strings! I just could not find examples of this in the Adobe documentation. So here I was in some cases adding temporary textFrames so I could get to my strings as text contents and then removing the temporary textFrames at the end of the script. In this particular case I needed to merge several paragraphs into one paragraph. Now that I know how to search & replace strings, it is so simple to strip away all the paragraph returns (which are included in text contents). I am learning, albeit rather slowly. Thanks again.
Regards,
Len Swierski

Similar Messages

  • How to Open Find/Change with menuAction

    Hi,
    Read the question carefully I'm asking how to open the Find/Change
    dialog, not how to toggle it.
    Toggling is easy enough:
    app.menuActions.itemByName("$ID/Find/Change...").invoke();
    But if it is open, this will close it, and vice versa.
    I'm wondering if there's any way to specifically make sure it's opened?
    Thanks,
    Ariel

    Hi Ariel,
    This probably won't help but see https://forums.adobe.com/message/4413557#4413557
    If you could perform some action that will fail if the panel is closed then you could use a try catch to determine its state.
    I'll leave it to you to think of what that action would be.
    Trevor

  • Find/change dialog box out of reach

    Hi, I’m unable to use the find/change dialog box; it’s out of reach!
    Even when I try to change the resolution of my screen, I still can’t get a grab at it

    I tried changing the resolution (see the two screen capture), but not trashing the preferences; will try that!

  • How to use Find Change to add FC in front of all item numbers?

    Hello,
    I am using Indesign CS5 on iMac, running OS 10.8.3.
    I designed a product catalog that has 148 pages. Now I need to save the same design and make a new catalog for our wholesalers. On the wholesalers catalog I need to change the item numbers and add FC in front of each item number. How can I use find change to find each item and change them with FC in front of the item numbers? The following are a few examples of the item numbers:
    LED-4042 I want to change it to FCLED-4042
    UA-42 I want to change it to FCUA-42
    SC-110 change it to FCSC-110
    KN-10 change it to FCKN-10
    etc....
    I am hoping there is a fast way to find and change these.  I was looking in to GREP, but I could not figure how to do this.
    Thanks,
    Omar

    One way would be to just run it and then *remove* any double FC's -- but GREP can do even more! One of its many functions is to scan ahead for the presence or absence of certain text, and only act when it is (or it is not) there. This is called "lookbehind" (before the text you want to match) and "lookahead" (after the text you want to match).
    In this case, you want to find a phrase starting with capitals, but NOT the exact string "FC". That's a job for Negative Lookahead -- Only Match If Not.
    Try this: search for
    \b(?!FC)\u+-\d+\b
    ... the Replace With stays the same.

  • Bug: Setting "Don't include footnotes" via scripting doesn't change the find/change dialog

    Hi,
    Small bug, but can be confusing. Whether you write this line:
    app.findChangeTextOptions.includeFootnotes = false;
    or this line:
    app.findChangeTextOptions.includeFootnotes = true;
    ... you won't see any different in the little footnotes button in the
    find/replace dialog, even though the setting does work via scripting.
    More testing is needed to see what can be done to get the UI in sync
    with the setting...
    Ariel

    The dialog isn't updated while it's displayed. But hiding the dialog and displaying it again (twice Ctrl+F) shows that the script did do its thing.
    Peter

  • How to load delta, changing the name of file for every day with open hub?

    Hi gurus,
    I load daily delta data from ODS to flat file, using open hub.
    The file is located on server. Now, if I do delta load from ODS to flat file, every day the file is overwritten, because it has the same name.
    I want to load delta data everyday to different file name, for example BW_20060101 , BW_20060102, BW_2006_01_03 ....
    How do I do that?
    Best regards,
    Uros

    Hi Uros,
    This thread may give you some idea
    Changing the file name n Flat file Extraction
    https://websmp107.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700002201112003E
    Regards,
    BVC

  • PS CS3: How to load all (Styles, Brushes, Custom Shapes, etc.)

    Is there something I'm missing regarding the loading of Styles, Brushes, Gradients, whatever... - en masse?
    In CS2 you could load all Styles at once, or brushes, or any other "Preset". Now in CS3, when I'm in (for example) the Styles palette and click on "Load Styles", a panel flies open to show that you are in fact looking into the directory where the Styles "live" - but there is nothing actually there to select.
    Do I really have to click on one, load it, append it, repeat, repeat, repeat? I'd love to know that I'm missing something. But I've tried every means I can think of to load Presets in bulk, to no avail.
    Thanks for any tips!

    Yep, that was it. When you drive it to the proper directory, in the PS folder, then you can select them all and load them in one fell swoop.
    Thanks so much for your time!
    All the best, Kevin

  • [JS] [CS3] How do you find an insertion point's paragraph index #?

    This is probably a very simple thing to do, but I haven't been able to find a way to reference this. Thanks in advance for any help provided.
    Len Swierski

    The unexpected higher number is exactly the problem. The paragraph index property has nothing to with the paragraph array position; it's the index of the first character of that paragraph. (Sorry -- you'll have to re-read that post ...)
    Fortunately you can still use the returned number. Using the handy function everyItem() on the text frame's Paragraphs collection, you can gather all "first character" indexes into an array. Then it's only a case of testing your InsertionPoint index against the values.
    Suppose you copy this post into InDesign and inspect each of the paragraph's indexes. You would get an array like this:
    [0, 237, 238, 508, 509 ]
    The first value points to the start of the first paragraph in "character count mode". The second value points to the empty line below the first paragraph (I suspect it points to the Return character in InDesign). Since there is nothing else on that line, the next paragraph starts exactly one character after that.
    I think the following script does what you need -- but beware! It works, just as you asked, on individual text frames. It even works correctly if the text frame starts in the middle of a paragraph in the previous linked textframe, and this paragraph will correctly be reported to be "#0" of the current frame.
    ip = app.selection[0].insertionPoints[0];
    parIndex = getParIndex(ip);
    alert (parIndex);
    function getParIndex (someIp)
         var allPars = someIp.parentTextFrames[0].paragraphs.everyItem().index;
         var loopy;
         for (loopy=allPars.length-1; loopy > 0; loopy--)
              if (someIp.index >= allPars[loopy])
                   return loopy;
         return 0;

  • JS CS3 How can I find -and delete- anchored empty images frames

    I have a script that works fine with text,
    I need the same function, but find and remove anchored empty image frames
    thx
    var myDoc = app.activeDocument
    for(var myCounter = myDoc.textFrames.length-1; myCounter>=0; myCounter--)
    var myFrames = myDoc.textFrames[myCounter]
    if (myDoc.textFrames[myCounter].contents == ""){
    myDoc.textFrames[myCounter].remove()

    I'd do it this way:
    1. Grab the document's allPageItems.
    2. Iterate over it, ignoring text frames.
    3. Check to see: (a) if the parent is a character and (b) if the graphics collection of the page item is empty. If so, delete it.
    Dave

  • HT1414 I have disabled the auto synch on connection of the IPhone5 and now ITunes will not show the iphone  as available. How can I find the dialog that will give me control over backup's?

    Where -on iTunes - can I find a control that will enable me to synch the Iphone.
    The auto synch on attaching is turned off

    There is no merge feature for itunes content, never was. Merge applies only to contacts and calendar entries.
    The itunes content sync is one way - computer to iphone. The exception is itunes purchases
    You can transfer the purchases from the iphone to itunes before you sync. File>Transfer Purchases

  • How do I find/change hard returns to soft?

    I tried it with ^n and ^p, but it says it's not finding any. I'm sure I'm just overlooking something. Thanks.

    This is a good guide http://oreilly.com/catalog/9780596517069
    But building GREPs is a bit of an art lol - what I mean is it takes a while to get all the tricks to building good GREPs. I find it's one of those things that practice makes perfect. You did the right thing asking here as there are brilliant GREPers here and understanding the GREP is more important than knowing the symbols, in my opinon (you can learn the symbols on the fly)

  • How can I find/ change Metadata?

    I have two questions involving Bridge's Metadata. First of all, where is the original XMP Metadata saved after a batch process? Where can it be retrieved?
    Secondly, is there anyway to make bridge automatically carry over information from one field into another? In other words, can I have 'file name' populate 'job identifier' with out going into some kind of reprogramming?

    Picking up from Leah's query:
    We are dealing with oodles (10,000+) of image files, some born digital and some scanned from film. The photographers and our partner organizations retain copies of the files and/or the original film and index/contact sheets, identified in various ways. We need to rename the files in a consistent manner for our long-term archiving, but we also need to retain somewhere the original filename and other legacy information (e.g., roll number, frame number, index sheet number, etc.) so that we can easily match up an image in our collection with its original. (For instance, to ask the organization holding the negative to rescan a given frame at a higher resolution.) So we need to store metadata such as the original file name, roll number, folder name, etc.--and when we rename files we need to retain the original file name. We would like to use the "Job Identifier" metadata field for all such information, potentially amending additional metadata several times. And we'd like to retain the original filename within this metadata field if possible. The "PreservedFileName" seems to store only the most recent previous name, so we'd like to read data from the "PreservedFileName" value and use that to populate (append, not replace) the "Job Identifier" field. Does this make our task clearer? Any suggestions will be appreciated.

  • CS4: How to load GREP styles from CS3?

    I imagine there must be a way to get my many custom GREP searches into CS4, but I know not how. Anyone know?
    Thanks in advance,
    Aaron

    Go to your InDesign CS3 Preferences folder (in Home > Library > Preferences > Adobe InDesign > Version 5.0) and you'll find a folder called Find-Change Queries. In there will be a GREP folder with your saved custom searches. Each saved search is a small .xml file.
    Copy those XML files and then paste them into the same place for your CS4 Preferences: Home > Library > Preferences > Adobe InDesign > Version 6.0 > en_US > Find-Change Queries > GREP.
    You don't need to quit out of either program to do this, as soon as yo paste in the GREP files they'll appear as options in the Find/Change dialog box.
    AM

  • JS:CS3 Newbie needs help! find/change character styles

    I'm new to scripting and JavaScript is giving me a headache, but I'll keep trying. What I'm trying to do is automate a few things so that the production time of our school newspaper is reduced while insuring accuracy.
    I've played around a little with the text find change sample and the changing or adding paragraph styles in the InDesignCS3_ScriptingGuide_JS.pdf and I barely understand what I'm doing.
    When us page designers receive text to place in the document, our editors mark the text with tags like: < b >text< / b >, where the word "text" is to be bolded. (there wouldn't any spaces between < and b and > etc. I just did that so It'll show up here). We have basic character styles and paragraph styles set up, and we just started working with nested styles.
    Is there a way we can search for the < b > tag and bold everything after it up until the < / b > tag? Sort of the way it does for html (the way it would do for this message if I took out the spaces). It'll be great if it could remove the tags as well, but if not, I know I could create a find/change script to do the removal afterwards.
    I appreciate any input.
    Thanks!

    You've not found yourself the easiest of tasks! You need GREP find/replace, not text. Do you have any experience with GREP? It's worth investigating, it's a powerful feature. The script below handles bold. For clarity, it doesn't do any error checking: it assumes that there's a document with text in it and that the document contains a character style called 'bold'.
    // talk to Indesign, nobody else
    #target indesign
    // reset the Find/Change dialog
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // find everything between <b> and  (including these codes)
    app.findGrepPreferences.findWhat = '<b>.+?</b>';
    // add 'bold' style
    app.changeGrepPreferences.appliedCharacterStyle = 'bold';
    // make the changes
    app.activeDocument.changeGrep();
    // now delete the <b> and </b> codes
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = '</?b>';
    app.changeGrep();
    You can adapt it easily to handle other codes, and at a later stage you could generalise it so that you needn't repeat whole bunches of code.
    Good luck with your first forays. Again, it's not the easiest of tasks, but it's worth getting to grips with.
    Peter

  • Find/change using end of paragraph marker /p

    Folks,
    We are attempting to remove a space at the end of a paragraph in unstructured documents.  If I enter ' \p' in the Find text field in the Find/Change dialog FrameMaker finds the the appropriate paragraphs.  If I then enter '\p' in the Change text field in the Find/Change dialog and click Change the space is removed.  However the target paragraphs style is also applied to the the following paragraph.  This occurs in FrameMaker 8,9 & 10.
    If the Find/Change scenario above is followed with these two paragraphs the first paragraphs style is applied to the second paragraph.
    paragraph 1 with a trailing space and using Heading 1 style
    paragraph 2 using Heading 2 style
    Any thoughts?
    regards
    Jon

    JonEBe wrote:
    Arnis,
    Thanks!
    Yes why bother indeed!  I am at the end of a rather lengthy process to convert the creation and output of Framemaker documents into a database with a web front end.  As part of this the existing documents are imported to save lengthy keying/rekeying.  The output from the system is then compared against the originals.  As a matter of course I stripped of leading or trailing spaces (it is amazing how many there are in a manually created/updated document) so we therefore have noisy comparison documents as a result.
    BTW the trailing spaces are apparently a legacy of the conversion from WordPerfect.
    My choices are to re-import without stripping the trailing space and remove them at a later date or create a script using the FDK, which I am very familiar with, and is the likely outcome!
    Jon
    Just a wild thought - a real GREP processor, not the mild imitation in FrameMaker, can find a construction like a space followed by a paragraph marker and delete the space without affecting the marker. The technique is a form of the "lookbehind" or "lookahead" feature. I'm zero-skilled at actually doing this beyond just mentioning it, but the technique might work in a MIF, or text conversion, of the file. Search Google for terms like "GREP lookbehind lookahead," without quotes.
    Another possibility is that once the FrameMaker file is converted to the database, it would be possible to use a database command to remove the space.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

Maybe you are looking for

  • I think I need a new iMac : /

    Hello, I have a 27in, late 2009 iMac ... that always ran Hot ... and now runs HOT with a nerve, grating JET ENGINE fan trying to cool it ... it's more and more prone to freezing up ... and the DVD drive just started fatally scratching disks ... as th

  • PO doc date non modifiable as per PO doc type

    Hi Please help me out. The document date of PO is modifiable, it can be given back date and also forward date during creation of PO. Is it possible to freeze the doc date during PO create(me21n)  for a particular PO doc type wise so that doc date wil

  • Workflow process to assign initiator to following step

    I'm very new to CQ...  I have a workflow with several steps.  I would like to have a process step that uses an ECMA script to assign the following step to the initiator.  I thought I could just use the regular workflow-initiator script that is provid

  • Is it possible to populate a value dynamically in a transaction variant?

    Depending on the user, the field plant in IQ01 (Location tab) should be automatically populated. I know it maybe possible with a user exit; however, is it doable with a transaction variant? Any idea would be appreciated.

  • Essbase Error 1016016

    Hi all,<BR><BR>Here's another error I can't find any information on. I received the error while running a script in the MaxL shell in an aggregate storage cube. I was using the "export database to data file" statement. The report is being created, bu