Scripts and Illustrator

Discussion in 'Graphic Design' started by PixelPusher, Aug 17, 2011.

to remove all ads.
  1. PixelPusher

    PixelPusher Super Moderator Staff Member

    Messages:
    1,077
    I'm not sure how many of you use scripts within Illustrator but if you do I thought I would share one that I modified from Adobe. This script creates a smooth downward scale of any text object. The effect is simple, but one that many people seem to want to do. It will work with any text object.

    Text Scaling
    Code:
    ChangeSize();
    
    function ChangeSize()
    {
        selectedItems = selection;
        // check to make sure something is selected.
        if (selectedItems.length == 0)
        {
            alert("Nothing is selected");
            return;
        }
    
        endIndex = selectedItems.length;
    
        for (index = 0; index < endIndex; index++)
        {
            pageObject = selectedItems[index];
            pageItemType = pageObject.typename;
    
                if (pageItemType == "TextFrame")
                {
                    // get the paragraphs from the selection.
                    theTextRange = pageObject.textRange;
                    paraTextRange = theTextRange.paragraphs;
                    numParagraphs = paraTextRange.length;
    
                       for (i = 0 ; i < numParagraphs ; i++)
                       {
                             aParagraph = paraTextRange[i];
    
                             charTextRange = aParagraph.characters;
                             charCount = charTextRange.length;
    
                             if (charCount > 1)
                             {
     
                                   beginFontSize = 50;
                                   endFontSize = Math.round(beginFontSize*0.2);
                                   fontChange = Math.round((beginFontSize - endFontSize)/(charCount-2));
                                   for (j = 0 ; j < charCount; j++)
                                   {
                                          theChar = charTextRange[j];
                                          theChar.size = currentFontSize;*** 
                                          currentFontSize = currentFontSize - fontChange;
                                   }
                             }
                       }
                 }
          }
    }
    
    
     
    Last edited: Aug 17, 2011
  2. PixelPusher

    PixelPusher Super Moderator Staff Member

    Messages:
    1,077
    If anyone knows more about reserved names in AI, let me know. I would love to take this script one step further and have the "beginFontSize" be whatever site the text is set to.

    I will have to look around to see if I can find out more.
     
  3. computerGeek

    computerGeek Banned

    Messages:
    212
    wow.. .this is great information.. .will definitely try this one.. .thanks a lot.. .
     
  4. shiva

    shiva New Member

    Messages:
    5
    A good exchange of information. Thank you!
     

Share This Page