Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

textFont

$
0
0

Hi,

Here is a script from Muppet Mark (until it does not work anymore ;-) ) I modified but I am stucked at line 25

If I comment it it works.

 

 

JPD

 

    ----------------------   Noname1.txt   ----------------------


1 /* target illustrator */
2
3 function main() {
4 if (app.documents.length == 0) {
5 alert("Please have an 'Illustrator' document before running this script.");
6 return;
7 }
8
9 var docRef = app.activeDocument;
10
11  with (docRef) {
12  var thisDate = getTodaysDate();
13  var docName = name;
14  var rectRef = pathItems.rectangle(-72,0,600,84); // T,L,W,H
15  var tcLayer = layers.add();
16  var areaTextRef = tcLayer.textFrames.areaText(rectRef);
17  var docRef=app.activeDocument;
18  var docName=activeDocument.name;
19  var droits = "Copyright " + getTodaysDate();
20  var texte = "\rThis work may not be reproduced electronically nor reprinted without permission of the copyright holder.";
21  var textString =droits + "\rjeanpierredaviau.com\r" + docRef.fullName + "  " + texte;
22  tcLayer.name = 'Copyright';
23  tcLayer.zOrder(ZOrderMethod.SENDTOBACK) ;
24  areaTextRef.textRange.characterAttributes.size = 10;
25  //textRef.textRange.characterAttributes.textFont =textFonts.getByName(textFonts[i].name);
26  areaTextRef.textRange.characterAttributes.TextFont.typename =  textFonts.getByName("Adobe TextPro-It");
27  areaTextRef.contents = textString;
28  }
29 }
30
31 main();
32
33 function getTodaysDate() {
34 var today = new Date();
35 var dd = today.getDate();
36  if (dd < 10) {dd ='0' + dd};
37
38 var mm = today.getMonth() + 1;
39  if (mm < 10) {mm ='0' + mm};
40
41 var yyyy = today.getFullYear();
42 var heure=today.getHours() + ":" + today.getMinutes();
43
44 var thisDate = dd + '/' + mm + '/' + yyyy + "  " + heure;
45
46
47 return thisDate;
48 }
49


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>