Skip to main content
Inspiring
December 3, 2025
Answered

Bold one word in ScriptUI - Possible?

  • December 3, 2025
  • 1 reply
  • 951 views

I'm wanting to show one word in my autocloseAlert message (https://community.adobe.com/t5/indesign-discussions/autoclosealert-customconfirm-and-customprompt-messages/td-p/15255213) in bold for emphasis (specifically in FrameMaker, but it's more a ScriptUI question).

 

Standard ideas don't work. For example:

AutocloseAlert("This is a <b>test</b>.)

Displays literally "This is a <b> test </b>."

Other variations like assingning test to a variable and then using variable.bold do the same thing.

Is this not supported by ScriptUI, or is there a workaround that I haven't found?

Thanks!

Correct answer m1b

@m1b - Hi Mark - I agree in principal with everything you say. I disagree in the details.

 

First, I'm using FrameMaker 2022. I was told by a member of the FrameMaker forum to ask here as there were more ScriptUI users on the InDesign forum.

 

Second - Peter's Setfont function still works in FM 2022. I use it to increase the font size. I assume it could set the text to bold also - haven't tried but it should work. That said, ScriptUI doesn't even work consistently between ExtendScriptToolKit and FM, so I'm not going to argue that it probably doesn't change font properties in ID.

 

Finally, the text is indeed displayed in a StaticText object. I didn't bother to set up a way to pass it a variable to change it to bold, but I could do that.

 

What I wanted to do was make ONE WORD in the displayed text bold.  I can't see a way to do that, unless I put the specific word in a separate StaticText object, and since the input text can change dynamically, I don't see that being feasible (or at least not worth the effort.)

 

<This is a "test."> is probably the best I can do.

 

Basically, as @Peter Kahrel said, I don't think what I requested can be done, unless someone else knows a workaround (but there are an awful lot of clever people on here, so I won't say it's impossible.)


Hi @Marshall_Brooks yes my apologies—I automatically assumed you were using Indesign even though I read your post! And you're right: each host application seems to have it's own version of ScriptUI.

 

Anyway. Would you mind trying this experiment in FrameMaker?

(function () {

    var w = new Window('dialog { text:"Bold word test" }');

    var fontFamily = ScriptUI.applicationFonts.dialog.family;
    var fontSize = ScriptUI.applicationFonts.dialog.size;

    var textGroup = w.add('Group { spacing: 3 }');

    textGroup.add('StaticText { text:"The quick" }');

    var boldWord = textGroup.add('StaticText { text:"bold" }');
    boldWord.graphics.font = ScriptUI.newFont(fontFamily, "Bold", fontSize);

    textGroup.add('StaticText {text:"fox jumps over the lazy dog." }');

    w.show();

})();

If the `newFont` method fails, try changing `fontFamily` var to a literal string, eg. "Arial-BoldMT" or something?

 

In Indesign it does nothing interesting so I have no idea if it works.

- Mark 

 

Edit 2025-12-05: changed the font size to use the ScriptUI default for dialogs.

1 reply

Peter Kahrel
Community Expert
Community Expert
December 3, 2025

Up to and including CS6 that was possible. Since then, no longer, unfortunately.

Inspiring
December 3, 2025

@Peter Kahrel - Thank you. I'm not sure what CS version I have, but is it safe to assume that if it doesn't work it can't be done with my version, then?

(I ended up putting quotes around the word, which gets the point across.)

Peter Kahrel
Community Expert
Community Expert
December 3, 2025

If you use CS3, 4, 5, or 6, you should be able to do it using ScriptUI's methods (not <b>...</b>). The details are in here: https://creativepro.com/files/kahrel/indesign/scriptui.html