@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.