Skip navigation
Home/Support/

Forums

414 Views 14 Replies Latest reply: Jun 2, 2010 2:39 AM by Roy Marshall RSS
Roy Marshall User 163 posts since
Apr 20, 2009
Currently Being Moderated

May 31, 2010 4:13 AM

[JS][CSX] ScriptUI Tip

Hi

 

I thought it was about time I contributed back on here, and share a quick tip I stumbled accross.

 

I have attached a screen shot of a dialog to select different scripts from, but you may notice the top text looks bold.

 

To make the text appear bold, simply repeat the line of code:

 

myText = myMainPanel.add('statictext',[15,15,260,34.5],'Choose the mailer to run the script for');

myText2 = myMainPanel.add('statictext',[15,15,260,34.5],'Choose the mailer to run the script for');

 

 

 

Anyway, just thought I'd share that with you.

 

Roy

Picture 5 copy.jpg

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    1. May 31, 2010 4:41 AM (in response to Roy Marshall)
    Re: [JS][CSX] ScriptUI Tip

    Cute!

     

    FWIW, the "official" way to use a bold font is like this:

     

            var font = myMainPanel.graphics.font.family;
            var fontSize = myMainPanel.graphics.font.size;
            var boldFont = ScriptUI.newFont (font,'BOLD',fontSize);
            var myText = myMainPanel.add('statictext',[15,15,260,34.5],'Choose the mailer to run the script for');
            myText.graphics.font = boldFont;
     
    

     

    Harbs

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    4. May 31, 2010 11:28 PM (in response to Roy Marshall)
    Re: [JS][CSX] ScriptUI Tip

    Sorry!

     

    Much nicer!

     

    Harbs

  • Steven.. User 302 posts since
    Dec 31, 2008
    Currently Being Moderated
    5. May 31, 2010 11:39 PM (in response to Roy Marshall)
    Re: [JS][CSX] ScriptUI Tip

    Beware, Harbs bold trick, doesn't always work on windows. I think panels specificly show bold text correctly on mac but not on Windows

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    6. May 31, 2010 11:43 PM (in response to Steven..)
    Re: [JS][CSX] ScriptUI Tip

    Steven,

     

    I didn't know it was a "trick"...

     

    Can you give more details? Which version?

     

    Harbs

  • Steven.. User 302 posts since
    Dec 31, 2008
    Currently Being Moderated
    7. May 31, 2010 11:57 PM (in response to Harbs.)
    Re: [JS][CSX] ScriptUI Tip

    Here is some Rapid ScriptUI code

     

     

    var rapidDlg = new Window('dialog',"Bold",undefined);
    buildWindow();
    rapidDlg.show();
     
    function buildWindow(){
     
     
    // Properties for rapidDlg.StaticText1
         rapidDlg.StaticText1 = rapidDlg.add('statictext',undefined,"Lets Be Bold");
    rapidDlg.StaticText1.graphics.font = ScriptUI.newFont(rapidDlg.StaticText1.graphics.font.family,"BOLD",rapidDlg.StaticText1.graphics.font.size);
     
    // Properties for rapidDlg.Panel1
         rapidDlg.Panel1 = rapidDlg.add('panel',undefined,"I'm Bold on a mac");
    rapidDlg.Panel1.graphics.font = ScriptUI.newFont(rapidDlg.Panel1.graphics.font.family,"BOLD",rapidDlg.Panel1.graphics.font.size);
     
    // Properties for rapidDlg.Panel1.Button1
         rapidDlg.Panel1.Button1 = rapidDlg.Panel1.add('button',undefined,"Hey Bold fellow");
    rapidDlg.Panel1.Button1.graphics.font = ScriptUI.newFont(rapidDlg.Panel1.Button1.graphics.font.family,"BOLD",rapidDlg.Panel1.Button1.graphics.font.size);
     
    }
     
     
    

     

     

    This is what it looks like on Windows XP SP3 using CS4 & CS5

    bold.JPG

     

    if I remember correctly it does show correctly on the mac

  • Marijan Tompa Participant 805 posts since
    Dec 17, 2006
    Currently Being Moderated
    8. Jun 1, 2010 12:23 AM (in response to Steven..)
    Re: [JS][CSX] ScriptUI Tip

    Hey Steven!

     

    Just tested your code here, Windows 7 64-bit, InDesign CS5, and it's same, panel text isn't bold.

     

    tomaxxi

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    9. Jun 1, 2010 12:56 AM (in response to Steven..)
    Re: [JS][CSX] ScriptUI Tip

    Yes. It's bold on Mac.

     

    So it's panel labels which have this problem.

     

    I assume the same happens if you use a reference to the window.graphics gont. Yes?

     

    Harbs

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    10. Jun 1, 2010 1:06 AM (in response to Steven..)
    Re: [JS][CSX] ScriptUI Tip

    Hmm.

     

    Actually, it's not Bold on the Mac -- I'd say it's Black. It's a much heavier weight than bold in other elements...

     

    Harbs

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    11. Jun 1, 2010 1:10 AM (in response to Harbs.)
    Re: [JS][CSX] ScriptUI Tip

    Here's what it looks like on Mac:

    2010-06-01_1009.png

  • Steven.. User 302 posts since
    Dec 31, 2008
    Currently Being Moderated
    12. Jun 1, 2010 12:00 PM (in response to Harbs.)
    Re: [JS][CSX] ScriptUI Tip

    even this doesn't work

     

     

    var rapidDlg = new Window('dialog',"Bold",undefined);
    buildWindow();
    rapidDlg.show();
     
    function buildWindow(){
     
     
    // Properties for rapidDlg.StaticText1
         rapidDlg.StaticText1 = rapidDlg.add('statictext',undefined,"Lets Be Bold");
    rapidDlg.StaticText1.graphics.font = ScriptUI.newFont("Arial","BOLD",rapidDlg.StaticText1.graphics.font.size);
     
    // Properties for rapidDlg.Panel1
         rapidDlg.Panel1 = rapidDlg.add('panel',undefined,"I'm Bold on a mac");
    rapidDlg.Panel1.graphics.font = ScriptUI.newFont("Gill Sans Ultra Bold","Regular",rapidDlg.Panel1.graphics.font.size);
     
    // Properties for rapidDlg.Panel1.Button1
         rapidDlg.Panel1.Button1 = rapidDlg.Panel1.add('button',undefined,"Hey Bold fellow");
    rapidDlg.Panel1.Button1.graphics.font = ScriptUI.newFont("Gill Sans Ultra Bold","Regular",rapidDlg.Panel1.Button1.graphics.font.size);
     
    }
     
    

     

     

    looks like this

     

    bold.PNG

    which means that the font object is not wired at all for panel on Windows

  • Harbs. Contributor 4,338 posts since
    Apr 19, 2004
    Currently Being Moderated
    13. Jun 1, 2010 12:10 PM (in response to Steven..)
    Re: [JS][CSX] ScriptUI Tip

    I wouldn't say it's not wired.

     

    If you pay attention, you'll notice that the border leaves room for the wider font. The text is just not drawn correctly...

     

    Harbs

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points