Skip to main content
Inspiring
March 1, 2026
Answered

set a special character designer

  • March 1, 2026
  • 7 replies
  • 446 views

Hello,

I would like to create a character designer adding automatically “underline + quotation mark” to a selected text. How to do it ?

    Correct answer Winfried Reng

    Hi,

    You could select text and then add the brackets with the help of regular expressions.

    In the Search field enter:

    (.+)

    Then select Regular Expressions.

    Replace it with text and enter:

    ($1)

    As Look-In select Selection.

    Then click Find (important! When you do not click Find, this does not work) and then Change.

    The brackets in the Search field means that this is an entity. The dot means any character, the + that there is more than a single character.

    The $1 in the Replace field means that this entity should be inserted. The brackets around $1 are the brackets which you want to add.

    Best regards, Winfried

    7 replies

    Matt-Tech Comm Tools
    Community Expert
    Community Expert
    May 5, 2026

    It sounds like you might be doing something easily managed by a variable in unstructured FrameMaker...Are you entering repetitive product names or similar?

    -Matt Sullivan, FrameMaker Course Creator, Author, Trainer, Consultant
    Matt-Tech Comm Tools
    Community Expert
    Community Expert
    May 5, 2026

    In structured FrameMaker you can define prefix and suffix for elements, making this quite easy.

    In unstructured/standard FrameMaker, you’re likely stuck with the scripting and other fine workarounds provided.

     

    -Matt Sullivan, FrameMaker Course Creator, Author, Trainer, Consultant
    Inspiring
    May 5, 2026

    Hi Matt ​@Matt-Tech Comm Tools 

    Have you a screenshot in order to show me how to do it inside structured FrameMaker (prefix and suffix for elements) ?

    Matt-Tech Comm Tools
    Community Expert
    Community Expert
    May 5, 2026

    Here is an example, conveniently pulled from my EDD Development workbook, updated for FrameMaker 18.0.0. Setting the prefix to show a closing quote is a slight follow-on detail, not a limitation.

     

    -Matt Sullivan, FrameMaker Course Creator, Author, Trainer, Consultant
    Inspiring
    May 4, 2026

    Finally, I think I would prefer to create these brackets on a text selection by creating a character designer (instead of “find/change”). How to do it in that case ?

    Community Expert
    May 4, 2026

    It can be scripted. Save this little piece of code as a *.jsx file. Add the script file to FrameMakers Script catalog under “File->Script”. Select a word and run the script.

     

    // Wrap selected text in quotation marks
    var doc = app.ActiveDoc;

    if (doc.ObjectValid()) {
        var tr = doc.TextSelection;

        // Check if there is actually a selection
        if (tr.beg.offset !== tr.end.offset) {
            
            // We insert at the end first so the start offset doesn't shift
            // Use "\u201D" for a curly closing quote or '"' for a straight one
            doc.AddText(tr.end, "\u201D"); 
            
            // Use "\u201C" for a curly opening quote or '"' for a straight one
            doc.AddText(tr.beg, "\u201C");
            
        } else {
            alert("Please select a word or phrase first.");
        }
    } else {
        alert("No active document found.");
    }

     

    Bjørn Smalbro - FrameMaker.dk
    Jeff_Coatsworth
    Community Expert
    Community Expert
    May 4, 2026

    Except they would need to edit it for doing ( and ) instead of quotes, right?

    Community Expert
    May 4, 2026

    This script merely adds qoutation marks. I can see now, that OP want to run it in a search and replace scenario along with underlining the text. That can probably be done too, I expect.

    My “script suggestion” was generated using Google Gemini, and to my absolute and utter amazement it worked! I am not smart enoough, however to do a “real” script. ​@frameexpert is. 

    Bjørn Smalbro - FrameMaker.dk
    Inspiring
    May 2, 2026

    Now, I would like to select a text and use the find/change function (in “selection” mode) in order to add parenthesis around the selected text. How to do it inside FM :

     

     

    Jeff_Coatsworth
    Community Expert
    Community Expert
    May 4, 2026

    Is this text phrase repeated throughout the doc or book? If so, then set the Change to “To Text” and put the phase in brackets. Don’t set the “Look in:” to “Selection” or it will only change that one instance.
    Edit:
    However, if you are looking at some tool to apply ( ) around some manually selected bit of text, I suspect you’d need to have some script running to do that. Assuming you don’t want to apply a new paragraph/character  tag that includes ( ) as part of its building blocks.

    Bob_Niland
    Community Expert
    Community Expert
    March 2, 2026

    If the terms (e.g. “apple”) are being defined or first used at some point in the document, further instances could be Xrefs to the defining instance, and it’s easy to apply the quotes and underline as part of the Cross-Reference Format.

    This also has the possibly [un]desired benefit of each referring use being a hypertext to the defining instance.

    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    March 1, 2026

    The underline part is easy, but character styles cannot add characters. If you are referring to a trailing or surrounding quotation marks, you should be able to create a unique character style that added the underline, then do a grep find/change at the very end of your formatting to add in the quotation marks.

    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Inspiring
    March 1, 2026

    Hi Dave,

    I understand how to set the character designer to obtain an underline, but I don’t know how to set the Find/Change window. My goal is to obtain this :

     

     

    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    March 2, 2026

    Oh, I see what you mean--I misspoke. FrameMaker can’t search for a character style and add characters. 

    Is there anything in the text that can indicate a unique pattern, such being preceded by a comma and followed by a period? 

    OR did the text come from a spreadsheet or other data source?

    OR do you have access to InDesign? (It can do what you need. Perhaps you can use the 7-day trial--just be SURE to cancel in time.)

    David Creamer: Community Expert (ACI and ACE 1995-2023)