Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bold one word in ScriptUI - Possible?

Enthusiast ,
Dec 03, 2025 Dec 03, 2025

I'm wanting to show one word in my autocloseAlert message (https://community.adobe.com/t5/indesign-discussions/autoclosealert-customconfirm-and-customprompt-me...) 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!

TOPICS
Scripting
311
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Dec 03, 2025 Dec 03, 2025

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

Translate
Community Expert , Dec 04, 2025 Dec 04, 2025

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 { spaci
...
Translate
Community Expert ,
Dec 03, 2025 Dec 03, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2025 Dec 03, 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.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2025 Dec 03, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2025 Dec 03, 2025

@Peter Kahrel - The link isn't working for me - connection reset. I found it from archive.org and have your guide already, but I don't see how to apply it to text being passed to a function.

The guide shows things like:

button2.graphics.font = "Tahoma-Bold:18";

I tried:

var text = "Test"
text.graphics.font = "Tahoma-Bold:18";
AutocloseAlert("This is a " + text);

But I get an exception on the second line "Undefined is not an object."
Thank you, though!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2025 Dec 03, 2025

@Marshall_Brooks be aware of what objects you have, and what properties/methods they have available. In the first case "button2" is a ScriptUIButton object (which has a graphics property, which has a font property) but in your test you have "text" which is a String. Strings do not have a graphics property.

 

Instead, inside your AutocloseAlert function I assume you are creating at least one StaticText object which would have a graphics property, which, in turn, would have a font property that you could set as Peter's documentation describes.

 

Having said that, as per what Peter said, if your version of Indesign was released in the last 12 years, then this won't work anyway, sadly.

- Mark

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 03, 2025 Dec 03, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2025 Dec 04, 2025

Sorry, @Marshall_Brooks, forgot you were in FrameMaker. Not as if you didn't mention it!

The issue is probably, as you say, that you can style the whole button (or static, etc.) text, but not part of it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2025 Dec 04, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2025 Dec 04, 2025

@m1b - Mark - Thank you, as I said, there are some VERY clever members on this forum.

 

That works a treat in FM. newFont works fine.

 

I've never been able to post  screenshots to this forum - still can't, I click the mountains and the upload window pops up and I can add the image and that works, but the button that says "done" never turns blue. I can post them to my Github account and link here if you want to see them.

It works fine, but the vertical spacing is off. I tried omitting "22" and changing it to "undefined" and both gave me errors. Setting it to "11" looks correct, but anything else and it is eather too high or too low compared to the rest of the text.

And while it does work - it's more trouble than I want to go through to implement. I was expecting something like <b> text </b> or <span:bold> text</span>, i.e. something that I could just pass as an argument to my function without having to define new parts of the function to accomodate this.

But this solution will help others who have the same issue (and happen to browse the ID forums for a FM solution ...)

Again - much thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2025 Dec 04, 2025
quote

I've never been able to post  screenshots to this forum - still can't


By @Marshall_Brooks

 

Just copy-paste the images into the message body. It's more convenient to view, too.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2025 Dec 04, 2025

>Just copy-paste the images into the message body. It's more convenient to view, too.

Doesn't seem to work. I copy the image to the clipboard and paste in a new message and the cursor moves down a space, but nothing appears. Then I click preview and it says invalid HTML was removed, but still no image.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2025 Dec 04, 2025

Oh right, yeah I put 22 (the text point size) just to make a dramatic visual difference. I'll edit the snippet above to (hopefully—I can't test!) keep the same size as the default, which is what anyone would probably want in practice.

- Mark

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 04, 2025 Dec 04, 2025
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines