Hi there,
does anybody know a way to add a Logosize of a selected item in mm to the Illustrator document?
The idea is to select a Logo and read out the Logo size in mm and add the text information in the Document. Best way would be a javascript to implement it with a Illustrator action.
I uploaded a scribble of the idea:
Best,
Christoph
1 Like
try this
if (app.documents.length>0){
var myDocument = app.activeDocument;
var mySel = myDocument.selection;
if (mySel.length == 1){
var myWidth = mySel[0].width;
var myHeight = mySel[0].height;
var x = mySel[0].left;
var y = mySel[0].top;
var pt2mm = 2.8346457; //proportion points millimeters
var myRound = 1000 //use 1 for integer, 10 for 1 decimal, 100 for 2 decimals, 1000 for 3 decimals
myWidth = Math.round(myWidth / pt2mm * myRound) / myRound
myHeight = Math.round(myHeight / pt2mm * myRound) /myRound
var myTextFrame = myDocument.textFrames.add();
myTextFrame.contents = myWidth+" x "+myHeight+" mm";
myTextFrame.top = y+20
myTextFrame.left = x
}
}
wow great, thats exactly what I needed, thank you!!!
Is there a way to add the word Logosize just in front of the sizes?
Logosize: 30 mm x 30 mm
yes
just replace this line
myTextFrame.contents = "Logosize: " + myWidth+" mm x "+myHeight+" mm";
great! Thank you so much. Is it possible to change the colour of the added text to red?