Script to make texts bold or italic

I saw someone suggested the following code to meet the need:
var app = new Illustrator.Application();
var doc = app.ActiveDocument;
var bold = doc.CharacterStyles["Bold"];
var italic = doc.CharacterStyles["Italics"];
var frame = doc.TextFrames[0];
bold.ApplyTo(frame);
italic.ApplyTo(frame);
But it does work in my case since "doc.CharacterStyles["Bold"];" and "doc.CharacterStyles["Italics"]" declare an error message of "No such element". Is there another way that I can try to make texts bold or italic?

look here
http://forums.adobe.com/thread/881071?tstart=0

Similar Messages

  • Script to make the text bold or italic

    I saw someone suggested the following code to meet the need:
    var app = new Illustrator.Application();
    var doc = app.ActiveDocument;
    var bold = doc.CharacterStyles["Bold"];
    var italic = doc.CharacterStyles["Italics"];
    var frame = doc.TextFrames[0];
    bold.ApplyTo(frame);
    italic.ApplyTo(frame);
    But it does work in my case since "doc.CharacterStyles["Bold"];" and "doc.CharacterStyles["Italics"]" declare an error message of "No such element". Is there another way that I can try to make the text bold or italic?

    look here
    http://forums.adobe.com/thread/881071?tstart=0

  • Make text bold using javascript

    To make it short and simple, here is what I need to do:
    In my javascript, I have a long string of concatinations. I need to be able to make some of the words in the string bold, and others normal. I have tried the str.bold() method and that doesn't seem to be working for me. It simply displays bold tags around the word in the text field when I preview (
    word). I have the text field as a 'rich text' as well as 'xhtml'.
    Any advice on how to bold words using javascript would be great. I have looked through the forums and havn't found anything helpful so far.
    I am using Livecycle 8.
    Thanks in advance.

    If you could give me an example, it would be great. I'm looking at the span object right now to see if it's something I could use.

  • Inserting PNG images in my document makes text bolder

    I created a simple InDesign file using text and JPG images. So far all fine.
    But on pages where I use PNG images instead of JPG images all text on the page is slightly bolder as if some sort of overprint would apply to all text boxes, even the once placed on the Master Page.
    I checked all overprint settings, it's not it.
    Any idea?
    Thanks
    ralph

    That is indeed the problem.
    Any ohter workaround than flattening the images in Photoshop?
    Thanks
    ralph

  • Mac Mail no longer allows me to make text bold

    I'm using Lucida Grande as my default font, and since installing Snow Leopard the command>b no longer emboldens the type. Even if I go to format>style>bold it still doesn't work. Even if I go to format>show fonts and select the bold version of the font it still doesn't work.
    Any ideas?

    Hi chaps & chapettes
    My system is running OS X 10.6.4 and Safari 5 (which is when the problems started) (and Mail 4.3)
    I managed to sort this problem after tryin everything from:
    *Font Book:*
    - resolving duplicates
    - validating fonts (and deleting all the warning & corrupted fonts)
    *Linotype FontExplorer X*
    - Clean system font caches
    system/library/fonts
    - manually deleting Helvetica and Helvetica Neue
    The solution that worked for me was to select all fonts in the FontBook application, and click EDIT>SELECT DUPLICATE FONTS
    Once selected, I simply disabled all of them... hey presto I can now, use shortcut keys for Bold and Italics in Mail.
    Hope it helps
    Matt

  • BUG - in flash pro CC, 'bold' and 'italic' properties of TextFormat have no effect on rendered text

    Concise problem statement:
    If you compile with flash pro CC, and use the 'setTextFormat' method of a TextField, the 'bold' and 'italic' properties of the TextFormat argument have no effect on the rendered text. If you compile with flash pro CS6, the 'bold' and 'italic' properties work as expected.
    Apparently, with flash pro CC, the only way to make the text render correctly is to change the font name (add the suffix ' Bold', ' Italic', or ' Bold Italic'.) This means code which dynamically changes font styles only works in CS6 or CC, but not both. For example, if you use the 'bold' property the text renders bold in CS6 and regular in CC, whereas if you change the font name to add the suffix ' Bold', the text renders bold in CC and DOES NOT RENDER at all in CS6. This makes it difficult to transition a team from CS6 to CC.
    Steps to reproduce bug:
    1. Create an xfl with 2 TextFields on the stage, both with font "Trebuchet MS" and style "regular", one named boldTrueText containing the String "bold = true", one named fontNameText containing the String "fontName = Trebuchet MS Bold". Create 2 more TextFields on the stage for visual reference, both with font "Trebuchet MS", one with style "regular", one with style "bold".
    2. Add the following code to the Actions panel on frame 1:
    import flash.text.TextFormat;
    import flash.text.Font;
    var format:TextFormat = boldTrueText.getTextFormat();
    format.bold = true;
    boldTrueText.setTextFormat(format);
    format = fontNameText.getTextFormat();
    format.font = "Trebuchet MS Bold";
    fontNameText.setTextFormat(format);
    var fonts:Array = Font.enumerateFonts(), count:int = fonts.length;
    for (var i:int = 0; i < count; i++) {
        var font:Font = fonts[i];
        trace("fontName: " + font.fontName + ", fontStyle: " + font.fontStyle);
    3. Save, and compile with flash pro CS6 and flash pro CC.
    Results:
    With flash pro CS6, "bold = true" renders bold, and "fontName = Trebuchet MS Bold" DOES NOT RENDER.
    With flash pro CS6, the following is traced:
    fontName: Trebuchet MS, fontStyle: bold
    fontName: Trebuchet MS, fontStyle: regular
    With flash pro CC, "bold = true" renders regular, and "fontName = Trebuchet MS Bold" renders bold.
    With flash pro CC, the following is traced:
    fontName: Trebuchet MS, fontStyle: regular
    fontName: Trebuchet MS Bold, fontStyle: bold
    Expected results:
    The same text is rendered in both flash pro CS6 and CC. I don't know why this behavior was changed in flash pro CC - it causes silent failures in code which dynamically changes font styles. I expected the flash pro CS6 behavior to remain the same in CC, like so:
    With flash pro CC, "bold = true" renders bold, and "fontName = Trebuchet MS Bold" DOES NOT RENDER.
    With flash pro CC, the following is traced:
    fontName: Trebuchet MS, fontStyle: bold
    fontName: Trebuchet MS, fontStyle: regular
    If you don't want to break backward compatibility (any further), you could make both the behaviors work in flash pro CC, like so:
    With flash pro CC, "bold = true" renders bold (font is still "Trebuchet MS"), and "fontName = Trebuchet MS Bold" renders bold also.
    With flash pro CC, the following is traced:
    fontName: Trebuchet MS, fontStyle: bold
    fontName: Trebuchet MS, fontStyle: regular
    fontName: Trebuchet MS Bold, fontStyle: bold
    I submitted this bug with the bug form, and also with adobe bugbase (in case it isn't obsolete) - I'm just trying to maximize my chances of getting a fix.  Has anyone else encountered this bug?

    I just can't believe how there is ZERO documenation for any of this.  Flash's stylesheets have fontStyle and fontWeight properties, but they only recognize regular/italic and regular/bold respectively.
    This change in Flash CC completely breaks systems built in Flash CS6, and the font naming is actually arbitrary and is not a consistant combination of font name and style (e.g. "Eras ITC" family's bold font name is "Eras Bold ITC", but the bold version of Times New Roman is "Times New Roman Bold" (with Bold at the end, rather than the middle), and what's absolutely appaling is that the font name used at runtime is not exposed anywhere in the Flash IDE!!!  In the IDE you select a font family and font style independently, which is absolutely not what's used at runtime, because it actually uses a separate, arbitrarily named field in the font file for the font name. So we can't even know from within Flash what the proper runtime name is, unless we trace it out or open the font properties details tab in Windows explorer.
    It seems that Flash CC is always using the font "Title" that can be found in the properties of the font, NOT the font name displayed in Windows Font Preview or in Flash CC.  For example, the font name for Times New Roman Bold in Windows Font Preview is just "Times New Roman", but the font title in the properties/details tab is "Times New Roman Bold".  If they made the change to allow for specific fonts to be selected, that's fine, but it completely breaks HTML support in TextFields if it's not respecting bold and italic tags.
    This may actually be a trend on the web now, if you read this: http://www.smashingmagazine.com/2013/02/14/setting-weights-and-styles-at-font-face-declara tion/ , it says: "If you’ve used one of FontSquirrel’s amazing @font-face kits, then you’re familiar with this approach to setting weights and styles. The CSS provided in every kit uses a unique font-family name for each weight and style, and sets the weight and style in the @font-face declaration to normal. [...] Notice that the font-family names are unique, with each font-family name accessing the appropriate Web font files."
    But there's just no mention of this in any documentation I can find.  What the hell.
    It's also helpful to realize that font and u tags have been deprecated in HTML5, while b and i tags have been repurposed since they still retain semantic meaning apart from style: https://www.w3.org/International/questions/qa-b-and-i-tags

  • BOLD  or Italic text

    Hi I am a beginner in the Java world
    Is there a way I can make text that I append to a midlet Form bold or Italic? If so how?

    Sorry, you can't use bold or italic in a form. You
    should use the canvas class instead. With canvas you
    can set the font using the Graphics.setFont(Font f)
    method.Atleast on a StringItem you can set font like this
    si = new StringItem(lbl, lbl);
    si.setFont(Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM));try also
    Font.STYLE_ITALIC
    Font.STYLE_PLAIN
    FONT.SIZE_SMALL
    FONT.SIZE_LARGEkari-matti

  • How do I make multiple text bold, for example scene headings or character names?

    How do I make multiple text bold, for example scene headings or character names?

    You can do that by editing the template of the document.
    Open the document, go to Edit->Template. A dialog will launch which will have element types on the left and it's properties on the right.
    Select Scene Heading(or Character name) on the left. On the right, go to 'Text' tab and click on Bold checkbox.
    Press OK.
    Hope this helps.
    Cheers,
    Sunny

  • Text appearing as Bold and Italic in CS4

    Hi Guys
    Whenever I create a new document and type into it the text is automatically 'bold' and 'italics', I have saved the page and opened on another computer running CS4 and the text is fine (not bold or italic). I have created a page on another computer and opened it on the troublesome one and again it is bold and italic ((
    I cannot see anything in the preferences that may cause it, I have also discarded the configuration folder which contains the preferences for the program - no good either (( So as a last resort I have re-installed Dreamweaver and it is still playing up. I guess I can re-installs the complete CS4 suite but rather not as it is going to take a while and also may not fix the problem.
    Any ideas anybody??

    I have just copied the code from the page as below and as you can see there is no bold or italic applied:-
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    hello
    </body>
    </html>

  • Is possible to have a script that makes a text randomly have caps and lower caps... i would love to create a kind of effect so it would look like manuscript - but it cannot be only the same letter in caps or lower caps - I wOuld NeEd oF SOmeTHing LikE Thi

    Is possible to have a script that makes a text randomly have caps and lower caps... i would love to create a kind of effect so it would look like manuscript - but it cannot be only the same letter in caps or lower caps - I wOuld NeEd oF SOmeTHing LikE This (random) - is it possibel?

    Hi,
    Sample with 2 regex:
    Launching the 1rst regex:
    Launching the 2nd regex:

  • Bold text appears bold and italic

    Hi Folks,
    Can anyone please explain why this happens?
    In FW when I click the bold text button, the text appears bold but italic aswell.
    Thanks in advance

    That's unusual. Which version of Fireworks and what operating system are you using?
    If you click on the Faux Italic button, is the italic styling removed? (It should be. If not, click twice.) You might want to try quitting and restarting the application—or shutting down and restarting your computer—and see if this takes care of the problem.
    FYI: It's generally a better choice to add bolding via the Font Style dropdown menu, if that style is available within the currently selected font family.

  • Bold and italic fonts in dynamic text fields.

    I have a dynamic text field with the text "IMAGES". The font
    is Arial, it has BOLD and ITALIC checked, and has basic Latin fonts
    embedded. Now, I use Actionscript to change the text:
    textField.text = "IMAGES";
    Suddenly the text disappears! Now, it seems to me that since
    BOLD and ITALIC are checked on the text field, changing the .text
    value should simply change the text itself, which should then be
    rendered in bold and italic, and since I have bold+italic Latin
    glyphs embedded, it should display properly. But what's clearly
    happening is that when I set the text using Actionscript, it is
    attempting to display the NORMAL font instead, and since it's not
    embedded, it won't display. I know this because if I create another
    proxy text field off the screen and embed the NORMAL Arial glyphs,
    the original text field's text will display just fine - as
    normal-weight text.
    But why is this? Do I have to use a TextFormat object to set
    the text to Bold and Italic EVERY time I want to dynamicaly change
    the text? This seems silly. I simply want my text field to be bold
    and italic every time the text changes, and NO normal text!
    Any ideas?

    I met the same problem using ActionScript3 and Flash Professional CS5. There are two problems with dynamic TextFields:
    - When you set style "Bold" for a text field in CS5, the "bold" property is not available in the TextField object in ActionScript, its defaultTextFormat.bold is alway false; I don't know if we can get this property anywhere else.
    - When you change the text of the dynamic TextField object, its style changes to normal no matter whether it was bold previously.
    This is really a bug in TextField, Adobe should fix this to implement TextField in an expected way.

  • My Mail 6.6 Won't Apply Bold or Italic to text

    My Mail 6.6 Won't Apply Bold or Italic to text – even if I switch from Rich to Plain Text in the Format menu. What is causing this? It used to work just fine…
    I'm running OSX 10.8.5, on an iMac 3.4 GHz Intel Core i7.
    Thanks for any solutions!

    This discussion suggests a solution.

  • Pages makes my text bold when I export to word

    I need to export a pages document to word and the text in this document is not bold but when I export to word it makes my whole text bold. it's driving me crazy and I've been trying for an hour now. Can someone please help me? What should I do to have a normal text in my word document. I don't want it to be bold!

    Last Fall, Apple released Pages v5. I tend to shorthand, and refer to this version and its subsequent minor revisions, as Pages v5+. Currently, it is at v5.2.2. Prior to Pages v5, Apple offered Pages ’09 v4.3, a more capable word processor.
    If you are making a CV for upload to job sites, they may restrict the size of your document to about 100 Kilobytes. The minimum Word export size in Pages v5 will be around 500 Kilobytes, while the older Pages v4.3 would do this in 10 - 30 Kilobytes. Another characteristic of Pages v5 is its tendency to make exported Word document text darker than good taste would dictate.
    In Pages v5, with the side Format panel set to Text and Style, click the globe adjacent to the text color well. Once the color chooser is open, select the second color panel from the toolbar. See images below. By default, Pages v5 has brightness set to zero, or really black text. I suggest you set this to 21%, and see if this produces more tasteful black text on export. You would need to select any text in your Pages document for this to take effect.

  • Make me Bold!

    Hi everyone, first time in here..
    Got this really annoying problem! Just made a text box scroll
    thing, which is working fine. Only problem is that I need to make
    some of the text bold in the external .txt file. I've been sticking
    the text in <b>here</b> but for some reason it doesn't
    work and it is driving me crazy! Here is my action script:
    var textLoader:URLLoader = new URLLoader();
    var textFile:URLRequest = new URLRequest("text/enlaces.txt")
    var scrollPercent:Number = 0;
    var minScroll:Number;
    var maxScroll:Number;
    var targetScroll:Number = text_mc.y;
    var easing:Number = 5;
    var scrollAmt:Number = 15;
    var scrollDirection:Number = 0;
    function textLoaded(event:Event):void
    text_mc.external_txt.htmlText = textLoader.data;
    minScroll = text_mc.y;
    maxScroll = minScroll - text_mc.height + mask_mc.height;
    function dragScroller(event:MouseEvent):void
    var dragX:Number = line_mc.x - scroller_mc.width/2;
    var dragY:Number = line_mc.y;
    var dragW:Number = 0;
    var dragH:Number = line_mc.height - scroller_mc.height;
    scroller_mc.startDrag(false, new
    Rectangle(dragX,dragY,dragW,dragH));
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
    stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
    stage.removeEventListener(Event.ENTER_FRAME, scrollText);
    function stopDragging(event:MouseEvent):void
    scroller_mc.stopDrag();
    function setScrollPercent(event:Event):void
    scrollPercent = (scroller_mc.y - line_mc.y) /
    (line_mc.height - scroller_mc.height);
    if(scrollPercent < 0)
    scrollPercent = 0;
    else if(scrollPercent > 1)
    scrollPercent = 1;
    targetScroll = (scrollPercent * (maxScroll - minScroll)) +
    minScroll;
    text_mc.y -= (text_mc.y - targetScroll) / easing;
    function scrollUp(event:MouseEvent):void
    setDirection(scrollAmt);
    function scrollDown(event:MouseEvent):void
    setDirection(-scrollAmt);
    function setDirection(dir:Number):void
    scrollDirection = dir;
    stage.addEventListener(Event.ENTER_FRAME, scrollText);
    stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
    stage.removeEventListener(Event.ENTER_FRAME,
    setScrollPercent);
    function scrollText(event:Event):void
    targetScroll += scrollDirection;
    text_mc.y -= (text_mc.y - targetScroll) / easing;
    if(text_mc.y > minScroll)
    text_mc.y = minScroll;
    targetScroll = minScroll;
    else if(text_mc.y < maxScroll)
    text_mc.y = maxScroll;
    targetScroll = maxScroll;
    scrollPercent = (text_mc.y - minScroll) / (maxScroll -
    minScroll);
    scroller_mc.y = (scrollPercent * (line_mc.height -
    scroller_mc.height)) + line_mc.y
    function stopScrolling(event:MouseEvent):void
    scrollDirection = 0;
    textLoader.load(textFile);
    scroller_mc.buttonMode = true;
    text_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
    scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN,
    dragScroller);
    textLoader.addEventListener(Event.COMPLETE, textLoaded);
    up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
    down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);
    Help Please

    use the trace() function to see if your html-text is loading
    correctly and make sure your textfield is html-enabled, though i
    don't think that would cause the problem when assigning a htmlText
    property.

Maybe you are looking for

  • How to restore my thunderbird account

    I tried to log on to my thunderbird account and it is not there. A window pops up asking me if I want to open a new account, which I did, but all of my saved information is gone. How can I restore the account with all of my saved files? Thanks for yo

  • WARNING - Firefox v25+ (PC) may be unsafe for On-line Banking, Bill Payment & other Financial transactions.

    Mozilla, do not remove this posting until you have fixed the following problem, or I will simply notify the press, and my US Senator, Senator Dianne Feinstein, Chair of the Senate Select Committee on Intelligence. Since Mozilla refuses to provide any

  • A problem with PoE devices in the Topology view (LMS 3.1)

    Hello, the customer has a problem with PoE devices in the Topology View. :-( He doesn't see the 2960 PoE devices with the PoE filter enabled in the topology view:-( He uses LMS 3.1 on Windows. In the NetPro discussion I found that the list of PoE dev

  • XI problems BP not created

    Hi experts I am using standard scenario MM-SUS and all is configured and working, but when I send vendor from R/3 to SUS not errors are find in SXI_MONITOR, SM58 and SMQ2, but for some reason the Business Partner is not cretaed in SUS. Please someone

  • Is pixel by pixel painting possible in standard MIDP?

    With pixel by pixel painting I mean painting each pixel on the screen instead of using methods like draweline and drawarc. I know that this is possible when using platform specific Java libraries, like Nokias. But is it also possible to do this in st