home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / Chip Temmuz 2004.iso / program / code / Adobe Illustrator CS Tryout / data1.cab / Program_Files / Presets / Scripts / Add Watermark.js next >
Encoding:
JavaScript  |  2004-01-07  |  775 b   |  32 lines

  1. // add watermark to front-most document
  2.  
  3.  
  4.  
  5. //$.bp();    //    Uncomment this line to cause the script to be run in the JavaScript debugger window.
  6.  
  7.  
  8.  
  9. var docCount = documents.length;
  10.  
  11.  
  12.  
  13. if (docCount == 0)
  14.  
  15. {
  16.  
  17.    documents.add();
  18.  
  19. }
  20.  
  21.  
  22.  
  23. var docRef = documents[0];
  24.  
  25. var destLayerRef = docRef.layers.add();
  26.  
  27. destLayerRef.name = "Watermark";
  28.  
  29.  
  30.  
  31. var textRef = destLayerRef.textFrames.add();
  32.  
  33. textRef.contents = "DRAFT";
  34.  
  35. textRef.opacity = 42;
  36.  
  37.  
  38.  
  39. var docHeight = docRef.height;
  40.  
  41. var docWidth = docRef.width;
  42.  
  43. textRef.height = docHeight/2;
  44.  
  45. textRef.width =  docWidth;
  46.  
  47.  
  48.  
  49. textRef.rotate(45, undefined, undefined, undefined, undefined, Transformation.CENTER);
  50.  
  51.  
  52.  
  53. textRef.width =  docWidth;
  54.  
  55. textRef.height = docHeight;
  56.  
  57. textRef.position = [0, docHeight];
  58.  
  59.  
  60.  
  61.  
  62.  
  63.