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

Prompt alert dialog font styling

Engaged ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

Is it possible to edit the font weight and font size from a PS prompt alert dialog?  

For example in the following example can, the Report Comment heading display in bold letters?

 

prompt ("Project : "
+ "\rFile Type : "
+ "\rProcess Time : "
+ "\rFile Count : "
+ "\r"
+ "\rReport Comment:");

 

Screen Shot 2021-06-26 at 2.48.56 PM.png

 

 

TOPICS
Actions and scripting

Views

2.6K

Translate

Translate

Report

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 1 Correct answer

LEGEND , Jun 26, 2021 Jun 26, 2021

No. Use ScriptUI.

Votes

Translate

Translate
Adobe
LEGEND ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

No. Use ScriptUI.

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

@Polycontrast â€“ Using the default system alert, prompt and confirmation windows is convenient, however, they are dependent on the OS in use. On the Mac, prior to Big Sur, the dialog widows presented the information in a serviceable fashion and they also looked clean, as your screenshot above illustrates.

 

Now, take a look at the same code in Big Sur:

 

big-sur.png

As one is using the default OS style, you are at the mercy of either Apple or Microsoft's styling decisions:

 

win10.png

 

 

 

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

Using ScriptUI, one has more control and at least the result is more consistent between different operating systems and versions of the same operating system.

 

Here is the same code on the Mac, then Windows:

 

scriptUI-Mac.png

scriptUI-Win.png

 

 

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

Haha, same code – two different results!

 

Looks like on Windows, it is truncating the text from "string" to "strin"...

 

Edit: OK, I just had to add a line of code to set the preferredSize.width as Windows appears to need this, when the Mac does not.

Votes

Translate

Translate

Report

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
Engaged ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

Thank you for the explanation. That is a big difference between the OS prompt dialogs. The script UI has an advantage over the default OS dialogs in terms of uniformity.  A better solution is to create the dialog using the script UI. I am unsure how to call the script UI instead of the prompt alert.  

Does this make sense?

1. Create the dialog using the scriptUI.

2. Wrap the UI in a function.

3. Call the UI function instead of the prompt alert, 

4. Pass the parameters to the UI function 

5. Get the user input

 

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

That is it. This is why I have been working on this as a "side project" community service. It should be a no brainer, why re-invent the wheel? If it is complex, challenging and frustrating for me, surely it has been for others in the past and will also be for others in the future!

 

This is just a replacement for "basic" UI windows, not a whole custom script interface such as one may find in say Image Processor Pro.

 

As luck would have it, I (think) that am almost at the end of this project.

 

You can find the code for the Alert here:

https://github.com/MarshySwamp/ScriptUI-Alert-Window

 

I'll post the Confirmation and Prompt code soon.

Votes

Translate

Translate

Report

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
Engaged ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

Thank you for providing the link and samples. Now, I have a better idea of how to think about alert boxes and what it takes to stylize the elements of the alert box. 

Votes

Translate

Translate

Report

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 ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

Your welcome! I think (hope) that I have ironed out the creases in the Confirmation and Prompt scripts.

 

I have not worked with ScriptUI much and generally prefer to avoid it where possible.

 

I'll give them one final round of testing and post them tonight.

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

What's wrong with ScriptUI you're trying to avoid it?

Votes

Translate

Translate

Report

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 ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied


@Kukurykus wrote:

What's wrong with ScriptUI you're trying to avoid it?


 

Let's say that I develop a script that works well without a GUI, perhaps this is based off existing code and I have to add or remove various bits... This may total up to say 3 hours of development time (coding, testing, finding fixes or workaround etc). This may work OK, but may be better off with a scriptUI interface.

 

Now even with the fantastic UI builder site from Joonas and the dummies guide from Peter Kahrel, it could increase the extra time to develop a script many times from the original time taken to write the script without GUI. So now a project that initally took 3 hours may blow out 9 or more hours. 

 

This is likely a reflection of my current level of knowledge and experience. It is very frustrating to perhaps spend 6 or more hours trying to get a button to do something, researching, deciphering cryptic forum posts etc. It's a bit like starting to learn scripting all over again, which I guess it is in some ways, just with less resources than before.

 

I'm a self taught enthusiast and this is a hobby, nobody forces me to do this, so I shouldn't be clock watching, but it is painful to spend so much time spinning my wheels when the answers are often so close but out of reach.

Votes

Translate

Translate

Report

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
Engaged ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

The script UI works well,  It takes more work to set it up but produces uniform results and offers more styling controls over the default OS alert box. I will try it when a window of time to experiment. Thanks for your recommendation! 

Votes

Translate

Translate

Report

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 ,
Jul 03, 2021 Jul 03, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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
LEGEND ,
Jul 04, 2021 Jul 04, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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 ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

LATEST

Thank you for that, I replied in the linked topic, at least I have multiple options!

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

Why don't you read the documentation (Javascript Tools Guide CC) to get to know how?

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied


@Kukurykus wrote:

Why don't you read the documentation (Javascript Tools Guide CC) to get to know how?



RTFM? Oh I have...

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

That was to Original Poster 😉

Votes

Translate

Translate

Report

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 ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

quote

That was to Original Poster 😉


By @Kukurykus

 

Ah, it is hard to know with these threaded forum replies... Unless you press the quote button or type the @ symbol and select a name it is hard to know.

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

To see who the post is answered to you may temporarily switch View to Linear.

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

The trick on Windows is also to add shortened space character after last letter to see full length of string.

Votes

Translate

Translate

Report

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 ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

I tried with a regular space character after the text, the line was still truncated. What is a "shortened space character"?

 

If it makes any difference, the text is being passed from a parameter in a function to a variable for the statictext.

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

'\u00A0'

Votes

Translate

Translate

Report

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 ,
Jun 27, 2021 Jun 27, 2021

Copy link to clipboard

Copied

Ah, a "non-breaking space character". This is obvioulsy a known issue, thanks!

Votes

Translate

Translate

Report

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 ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

As a learning exercise and to give new scripters such as myself a headstart, I have been making Script UI configurable versions of the standard "user notification dialogs" (Alert, Prompt, Confirmation).

 

What do I mean by configurable? Simply that I have put the UI into a function, replaced statictext.text with variables, then one can replace the variables as needed when calling the function with parameters. This makes the code reusable as one may use these features multiple times in a larger script.

 

Script UI - Alert:

scriptUI Custom Alert Window Script.png

 

Script UI - Confirmation:

scriptUI Custom Confirmation Window Script.png

 

Script UI - Prompt:

scriptUI Custom Prompt Window Script.png

 

Although an icon/picture could be included, I decided against this to keep the code concise

Votes

Translate

Translate

Report

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