home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 86 / PIWD86.iso / pc / contents / illustration / software / Installer / data1.cab / Program_Files / Presets / Scripts / ApplyStyleToTextSelection.js < prev    next >
Text File  |  2001-11-29  |  864b  |  45 lines

  1. // Apply a style to selected text.
  2.  
  3. ApplyStyle();
  4.  
  5. function ApplyStyle() 
  6. {
  7.     selectedItems = selection;
  8.  
  9.     // check to make sure something is selected.
  10.     if (selectedItems.length == 0)
  11.     {
  12.         alert("Nothing is selected");
  13.         return;
  14.     }
  15.  
  16.     endIndex = selectedItems.length;
  17.  
  18.     for (index = 0; index < endIndex; index++)
  19.     {
  20.  
  21.         pageObject = selectedItems[index];
  22.         pageItemType = pageObject.typename;
  23.  
  24.         if (pageItemType == "TextArtItem")
  25.         {
  26.             theTextRange = pageObject.textRange();
  27.             theTextRange.size = 48;
  28.  
  29.             theArtStyles = activeDocument.artStyles;
  30.  
  31.             if (activeDocument.documentColorSpace == DocumentColorSpace.CMYK)
  32.             {
  33.                 useArtStyle = theArtStyles["Caution Tape"];
  34.                 useArtStyle.applyTo(pageObject);
  35.             }
  36.             else
  37.             {
  38.                 useArtStyle = theArtStyles["Blue Goo"];
  39.                 useArtStyle.applyTo(pageObject);
  40.             }
  41.         }
  42.     }
  43. }
  44.  
  45.