Setting font and color TextItems

This script is failing to set font, and how can I set font color?; I am new to PS Scripting:
     var originalUnit = preferences.rulerUnits
      preferences.rulerUnits = Units.INCHES
     var docRef = app.documents.add( 11, 17, 300, "Test", NewDocumentMode.CMYK)
    MyLayer = docRef.artLayers.add()
     MyLayer.kind = LayerKind.TEXT
     var myFont = app.fonts.getByName("ArialMT");
     // Set the contents of the text layer.
     var textItemRef = MyLayer.textItem
     textItemRef.font = myFont;
     textItemRef.size = UnitValue(36, 'pt');
     textItemRef.font = '_Aviano-Regular';
     textItemRef.style = "Italic";
     textItemRef.contents = "Sample Text";
     // Restore original ruler unit setting
      app.preferences.rulerUnits = originalUnit
Thanks

The font needs to be the postscript name, this will give you a list of them.
var Dlog =
"dialog{text:'Script Interface',bounds:[100,100,500,270],"+
"FontName:DropDownList{bounds:[30,40,370,60]},"+
"PostScriptName:DropDownList{bounds:[30,100,370,120]},"+
"statictext0:StaticText{bounds:[40,10,200,30] , text:'Font Name'},"+
"statictext1:StaticText{bounds:[40,70,141,87] , text:'Postscript Name'},"+
"button0:Button{bounds:[140,130,240,150] , text:'Ok' }}";
win = new Window(Dlog,"Use the Postscript Name in your script.");
var item;
var item2;
for (var i=0,len=app.fonts.length;i<len;i++) {
  item = win.FontName.add ('item', "" + app.fonts[i].name);
  item2 = win.PostScriptName.add ('item', "" + app.fonts[i].postScriptName);   
win.FontName.selection = win.FontName.items[0] ;
win.PostScriptName.selection = win.PostScriptName.items[0] ;
win.FontName.onChange = function() {
win.PostScriptName.selection = win.PostScriptName.items[parseInt(this.selection)] ;
$.writeln(win.PostScriptName.items[parseInt(this.selection)]);
win.PostScriptName.onChange = function() {
win.FontName.selection = win.FontName.items[parseInt(this.selection)] ;
win.center();
win.show();
Here is your code with colour addded...
     var originalUnit = preferences.rulerUnits
      preferences.rulerUnits = Units.INCHES
      var FillColor = new SolidColor;
    FillColor.rgb.hexValue = 'ff0000';
     var docRef = app.documents.add( 11, 17, 300, "Test", NewDocumentMode.CMYK)
    MyLayer = docRef.artLayers.add()
     MyLayer.kind = LayerKind.TEXT
     var myFont = "ArialMT";
     // Set the contents of the text layer.
     var textItemRef = MyLayer.textItem
     textItemRef.font = myFont;
     textItemRef.size = UnitValue(36, 'pt');
     textItemRef.font = myFont;
     //textItemRef.style = "Italic";
     textItemRef.fauxItalic = true;
     textItemRef.contents = "Sample Text";
     textItemRef.color = FillColor;
     // Restore original ruler unit setting
      app.preferences.rulerUnits = originalUnit

Similar Messages

  • How do I change font and colors back to default?

    I have changed the font and color of the text through the tools button and the options button and the content tab. I find nothing telling me how to change the font and colors back to default font and colors. Can you advise me? I'm using Windows 7 Home Premium OS. Thanks.

    Hi Brenda19605,
    You can use this article to set the fonts and colors: https://support.mozilla.org/en-US/kb/change-fonts-and-colors-websites-use?esab=a&s=font&r=0&as=s
    The default settings for the font are in this article:
    https://support.mozilla.org/en-US/kb/Some%20text%20shows%20up%20bold%20after%20upgrade
    Unfortunately for the default colors has no good reference. But for text it is black (most lower left) color, background is white (most upper left color). Unvisited links is blue (column 8, row 5) and visited link is purple (column 9, row 5).
    Let me know if you need anymore help!
    Lordfreak

  • Converting fonts and colors in master templates

    Hello,
    I'm learning Keynote 09. In order to create a new project, I clicked on the "White" theme chooser.
    I'd like to personalize the slides in that theme by changing the fonts and colors. What's the best/fastest way to do this?
    Thank you!
    Joe

    I agree Joe that that would be a simple and obvious productive feature equivalent to Stylesheets in DTP.
    Unfortunately if there is a theme running through all of Apple's software today it is the absence of retrospective editing ability.
    The closest you will get is to start off with your own Master and build on that using default attributes, refer to p224 in the UserGuide. This will carry through styles to +newly created+ material. If you want to change the set of master slides uniformly, it does mean going back to scratch.
    You could try providing feedback to Apple why this is obviously such a bad idea. However I think they have made their mind up already, at odds with 25 years of computer experience to the contrary.
    Peter

  • Hyperion web analysis can not change font and color

    In Hyperion web analysis, when I want to set or change font, a null dialogbox appear ; when I click and want to set or change color, nothing happen,even no dialogbox appears. Why?
    thanks advance!
    Edited by: user1016218 on 2010-1-8 上午7:16

    Hello,
    See my answer in this link:
    Urgently!  In Hyperion web analysis  font and color can not be changed
    May be it helps.

  • Customize font and color in mail....

    When I write an email, well actually when I write anything... I use a lot of parenthesis.  It's part of my writing style.  I have Lion (will eventually get Mt. Lion) and in the mail program when I've written my emails I go back and make all the text in the parenthesis a smaller font and a gray color.  Is there a way to set up a keystroke or something so I can do this more easily?
    Thanks for any help.
    Susan

    Mail -> Preferences -> Fonts & Colors
    If you want to change the font and color in a message you're composing, you can right-click on the message and use the Font/Show Fonts command to bring up the Font panel (among other ways).
    Regards.

  • Fonts and Colors for Sub-Tabs

    Does anyone know of a way that I can specifiy fonts and colors
    for sub-tabs. I have a second row of tabs (sub-tabs) on one of
    my pages and I can't seem to find where I can set the font and
    colors for the sub-tabs. Also, the sub-tabs do not inherit the
    same font and color as the main tabs.
    Anyone have any suggestions?

    Hi, What I can tell you is that you can either edit the page and
    hit the style tab then edit the current style(the one you are
    currently using in your page) and change all the banners tabs
    (active and inactive) the background color, background image,
    etc, I believe the second tab row and any others are by default
    the same as the first row.
    Rgds, Carolina.

  • How can I change the font and color of an email signature?

    How can i change the font and color of an email signature?

    Mail > Preferences > Signature
    Highlight the Signature.
    Click Format in the menu bar and select " Show Fonts".
    Select the Font.
    Highlight the Text.
    Click Format in the menu bar and select " Show Colors".
    Select the color.
    Mail > Preferences > Composing > Message Format:  Rich Text
    Best.

  • I would like to print links as regular text i.e. not underlined or in a different font and color.

    I have created a page with my resumé, using Dreamweaver CS4 on my iMac (running OS X 10.6.6).  You can see the page here: http://www.peterforkes.com/Resume.html
    It looks great when it is on the screen, but when I print it I would like the links to not be underlined and also to be displayed in the same font (and color) of the text surrounding it (a link is largely useless on a piece of paper, if it it not showing the URL).
    So, I created a stylesheet called "print.css" and have this in it:
    a:link {
    text-decoration: none;
    In my html document (Resume.html)  I have this code, at the top:
    <link href="_css/Resume.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="_css/Print.css" rel="stylesheet" type="text/css" media="print" />
    Now, things such as the graphics in my document do not print out (this is how I want it) but links seesm to be doing unexpected things for me.  As I mentioned, when I print the page I would like them to:
    a) not print with an underline (which I would expect the code snippet shown above to do).
    b) I would like the link color to be the same as the surrounding text (I have links in several places, such as in <h2>, <h3> and <p>).
    c) I would like the link to have the same font and text size as the surrounding text.
    Any help is always appreciated.
    Peter A. Forkes

    You've solved it for a:link but you may print the page with the <a> tag in link or visited state so you need to cover both.
    In http://www.peterforkes.com/_css/Print.css
    change
    a:link {
    text-decoration: none;
    to
    a:link, a:visited {
    color: #333;
    text-decoration: none;

  • Unable to send mail with different fonts and colors

    Hi All,
    here is the explanation for my problem:
    I am sending mail using javamail. when i send the text with different font and color its not received in the same way. it is simply sending as plain text.
    Please help me on this issue.
    Thanks
    NG

    Hello,
    I am trying to develop an email application. It consists on sending email from [email protected] to [email protected]
    How can I do this in java ?
    I am using this software but it works only with gmail !!
             * Send Email to the webmaster
             String  d_email = "[email protected]",
                     d_host = "smtp.gmail.com",
                     d_port  = "465",
                     m_to = "[email protected]",
                     m_subject = "Email from user";
             Properties props = new Properties();
             props.put("mail.smtp.user", d_email);
             props.put("mail.smtp.host", d_host);
             props.put("mail.smtp.port", d_port);
             props.put("mail.smtp.starttls.enable","true");
             props.put("mail.smtp.auth", "true");
             props.put("mail.smtp.debug", "true");
             props.put("mail.smtp.socketFactory.port", d_port);
             props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
             props.put("mail.smtp.socketFactory.fallback", "false");
             SecurityManager security = System.getSecurityManager();
             try
                Authenticator auth = new SMTPAuthenticator();
                Session session = Session.getInstance(props, auth);
                //session.setDebug(true);
                MimeMessage msg = new MimeMessage(session);
                msg.setText("This is a message from: "+UserEmail+"\n "+UserMessage);
                msg.setSubject(m_subject);
                msg.setFrom(new InternetAddress(d_email));
                msg.setSentDate(new Date());
                msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
                Transport.send(msg);
             catch (Exception ex)
                ex.printStackTrace();
                out.println("Messaging ERROR: " + ex);
                out.println(stack2string(ex));
                    if(ex.getMessage().compareTo("")!=0)
                        check = "Message NOT SENT " + ex.getMessage();
        private class SMTPAuthenticator extends javax.mail.Authenticator
            public PasswordAuthentication getPasswordAuthentication()
                return
    new PasswordAuthentication("[email protected]", "pwd");
        }please advice

  • Can I show different fonts and colors text on 1 multi-line text fields?

    I want to format different messages on 1 mutli-line field with different fonts and colors for the heading lines. Can I do that in Forms 6i ?

    You must use in trigger Post-query the sentence:
    Example:
    DECLARE
    cur_itm VARCHAR2(80);
    cur_block VARCHAR2(80) := :System.Cursor_Block;
    BEGIN
    cur_itm := Get_Block_Property( cur_block, FIRST_ITEM );
    WHILE ( cur_itm IS NOT NULL ) LOOP
    cur_itm := cur_block||'.'||cur_itm;
    Set_Item_Instance_Property( cur_itm, CURRENT_RECORD,
    VISUAL_ATTRIBUTE,'My_Favorite_Named_Attribute');
    cur_itm := Get_Item_Property( cur_itm, NEXTITEM );
    END LOOP;
    END;

  • How can i change the font and color in mail 5?

    how can i change the font and color in mail 5?

    Mail -> Preferences -> Fonts & Colors
    If you want to change the font and color in a message you're composing, you can right-click on the message and use the Font/Show Fonts command to bring up the Font panel (among other ways).
    Regards.

  • Illustrator not recognizing some fonts and colors.

    My recently installed Illustrator is not recognizing certain fonts and colors which is producing problems in my designs.
    1. When I drag in a PDF to edit, the letters will appear as gibberish (random numbers, letters and signs) (the font was "arquitectura" which is installed on my OS X I Mac)
    2. When I try to change the color of a font using the eyedropper tool, it shows the proper color in the color box, but the font remains black.
    After googling it, these problems seem frequent back in 2009 but not so much today.  Im thinking it has something to do with this, which prompts when I open the application:
    "Your application install seems to be damaged, Please reinstall the application."

    sugarfactory,
    "Your application install seems to be damaged, Please reinstall the application."
    Obviously, you should. It is best to run the Cleaner Tool between uninstalling and reinstalling.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6

  • Changing link navigation bar font and color

    Is it possible to change the font and color on the links for each page on iWeb?

    Welcome to the Apple Discussions. Yes, with the code and a HTML snippet that's described in this tutorial: #24 - How to Change the Basic, Rollover and Visited Color of an iWeb Navbar.
    However, if you want to create a site that is more search engine friendly I suggest you create a text based navbar as described in this demo page: Text Based Navbar. If you don't have a lot of pages in your site it's not too difficult.
    OT

  • Font and Colors don't appear?

    Hi, recently found out that my font and color choices for AOL do not show up on other people's computers. I can view their font and colors...why can't they see mine?

    Oh...I didn't specify this, but it is people using the actual AOL client (both windows and mac) that can't see it.

  • I want to override webpage fonts but tools/options/fonts and colors/advanced/[]Allow pages to choose their own fonts doesn't work (unchecking it)

    tools/options/fonts and colors/colors does work to some extent - it does not overide link colors, but I don't really care about that. ^+ and ^- (ie control plus/minus) do work to change size to some extent - everything bigger/smaller, but of course not everything size=20, eg. I know there must be a way to do this sort of thing because years ago I could do it in Netscape.

    Some extensions that you can look at:
    * Default FullZoom Level - https://addons.mozilla.org/firefox/addon/6965
    * NoSquint - https://addons.mozilla.org/firefox/addon/2592

Maybe you are looking for