Код:
newCMYKColor = new CMYKColor();
if ( app.documents.length > 0 && app.activeDocument.swatches.length > 0 )
for ( i = 0, j=0; i < app.activeDocument.swatches.length; i++ )
{
currentSwatch = app.activeDocument.swatches[i];
textRef = app.activeDocument.textFrames.add();
textRef.top = j;
textRef.left = 0;
textRef.contents =currentSwatch.name;
textRef.textRange.characterAttributes.fillColor = currentSwatch.color;
j-=12;
}
var newCMYKColor = new CMYKColor();
newCMYKColor.cyan = 100;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
newCMYKColor.black = 0;
textRef = app.activeDocument.textFrames.add();
textRef.contents = "CYAN";
textRef.top = j;
textRef.left = 0;
textRef.filled = true;
textRef.textRange.characterAttributes.fillColor =newCMYKColor;
var newCMYKColor = new CMYKColor();
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 100;
newCMYKColor.yellow = 0;
newCMYKColor.black = 0;
textRef = app.activeDocument.textFrames.add();
textRef.contents = "MAGENTA";
textRef.top = j-12;
textRef.left = 0;
textRef.filled = true;
textRef.textRange.characterAttributes.fillColor =newCMYKColor;
var newCMYKColor = new CMYKColor();
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 100;
newCMYKColor.black = 0;
textRef = app.activeDocument.textFrames.add();
textRef.contents = "YELLOW";
textRef.top = j-24;
textRef.left = 0;
textRef.filled = true;
textRef.textRange.characterAttributes.fillColor =newCMYKColor;
var newCMYKColor = new CMYKColor();
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
newCMYKColor.black = 100;
textRef = app.activeDocument.textFrames.add();
textRef.contents = "BLACK";
textRef.top = j-36;
textRef.left = 0;
textRef.filled = true;
textRef.textRange.characterAttributes.fillColor =newCMYKColor;
var today = new Date();
textRef = app.activeDocument.textFrames.add();
textRef.contents=today.toLocaleDateString();
Вот с вашей помощью запилил примерно то что мне нужно, может можно и не так топорно это сделать, но я только начинающий хацкер))))
В процессе появился вопрос -
если я пытался покрасить надпись так:
textRef.filled = true;
textRef.fillColor =newCMYKColor;
то ничего не получалось - почему?
И еще вопрос - можно ли выводить текст из буфера обмена?