News und Tutorials zu Adobe Photoshop

[GastForen Programme Print/Bildbearbeitung Adobe Photoshop

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste

Festlegen eines Farbfeldes mit dem Text-Farbwähler

jekyll
Beiträge gesamt: 2047

1. Dez 2006, 16:27
Bewertung:

gelesen: 1746

Beitrag als Lesezeichen
Hi Anton,
ich habe den Skript etwas erweitert. Hier brauchst Du nur eine Datei offen zu haben.
Der Skript erstellt Farbfelder von allen Textebenen (bei mehrfarbigen Wörter wird nur die erste Farbe genommen).
Die Name von den Farbfeld hat dann die Name von der Textebene.

Code
var dokRef = activeDocument;  

for (einEbene =0;einEbene<dokRef.layers.length; einEbene++){
var ebeneRef = dokRef.layers[einEbene];
var ebeneTyp = ebeneRef.kind;
var ebName = ebeneRef.name;
if (ebeneTyp == "LayerKind.TEXT"){
var textColorModel = ebeneRef.textItem.color.model;
var textColor = ebeneRef.textItem.color;
//CMYK
if(textColorModel == "ColorModel.CMYK"){

var newCyan = textColor.cmyk.cyan;
var newMagenta = textColor.cmyk.magenta;
var newYellow = textColor.cmyk.yellow;
var newBlack = textColor.cmyk.black;

var id770 = charIDToTypeID( "Mk " );
var desc149 = new ActionDescriptor();
var id771 = charIDToTypeID( "null" );
var ref127 = new ActionReference();
var id772 = charIDToTypeID( "Clrs" );
ref127.putClass( id772 );
desc149.putReference( id771, ref127 );
var id773 = charIDToTypeID( "Usng" );
var desc150 = new ActionDescriptor();
var id774 = charIDToTypeID( "Nm " );
desc150.putString( id774, ebName );
var id775 = charIDToTypeID( "Clr " );
var desc151 = new ActionDescriptor();
var id776 = charIDToTypeID( "Cyn " );
desc151.putDouble( id776, newCyan );
var id777 = charIDToTypeID( "Mgnt" );
desc151.putDouble( id777, newMagenta );
var id778 = charIDToTypeID( "Ylw " );
desc151.putDouble( id778, newYellow);
var id779 = charIDToTypeID( "Blck" );
desc151.putDouble( id779, newBlack);
var id780 = charIDToTypeID( "CMYC" );
desc150.putObject( id775, id780, desc151 );
var id781 = charIDToTypeID( "Clrs" );
desc149.putObject( id773, id781, desc150 );
executeAction( id770, desc149, DialogModes.NO );
}

//RGB
if(textColorModel == "ColorModel.RGB"){

var newR = textColor.rgb.red;
var newG = textColor.rgb.green;
var newB = textColor.rgb.blue;

var id833 = charIDToTypeID( "Mk " );
var desc164 = new ActionDescriptor();
var id834 = charIDToTypeID( "null" );
var ref133 = new ActionReference();
var id835 = charIDToTypeID( "Clrs" );
ref133.putClass( id835 );
desc164.putReference( id834, ref133 );
var id836 = charIDToTypeID( "Usng" );
var desc165 = new ActionDescriptor();
var id837 = charIDToTypeID( "Nm " );
desc165.putString( id837, ebName );
var id838 = charIDToTypeID( "Clr " );
var desc166 = new ActionDescriptor();
var id839 = charIDToTypeID( "Rd " );
desc166.putDouble( id839, newR );
var id840 = charIDToTypeID( "Grn " );
desc166.putDouble( id840, newG);
var id841 = charIDToTypeID( "Bl " );
desc166.putDouble( id841, newB );
var id842 = charIDToTypeID( "RGBC" );
desc165.putObject( id838, id842, desc166 );
var id843 = charIDToTypeID( "Clrs" );
desc164.putObject( id836, id843, desc165 );
executeAction( id833, desc164, DialogModes.NO );
}
//LAB
if(textColorModel == "ColorModel.LAB"){

var newL = textColor.lab.l;
var newA = textColor.lab.a;
var newB = textColor.lab.b;

var id813 = charIDToTypeID( "Mk " );
var desc159 = new ActionDescriptor();
var id814 = charIDToTypeID( "null" );
var ref131 = new ActionReference();
var id815 = charIDToTypeID( "Clrs" );
ref131.putClass( id815 );
desc159.putReference( id814, ref131 );
var id816 = charIDToTypeID( "Usng" );
var desc160 = new ActionDescriptor();
var id817 = charIDToTypeID( "Nm " );
desc160.putString( id817, ebName );
var id818 = charIDToTypeID( "Clr " );
var desc161 = new ActionDescriptor();
var id819 = charIDToTypeID( "Lmnc" );
desc161.putDouble( id819, newL );
var id820 = charIDToTypeID( "A " );
desc161.putDouble( id820, newA );
var id821 = charIDToTypeID( "B " );
desc161.putDouble( id821, newB);
var id822 = charIDToTypeID( "LbCl" );
desc160.putObject( id818, id822, desc161 );
var id823 = charIDToTypeID( "Clrs" );
desc159.putObject( id816, id823, desc160 );
executeAction( id813, desc159, DialogModes.NO );
}

//HSB
if(textColorModel == "ColorModel.HSB"){

var newH = textColor.hsb.h;
var newS = textColor.hsb.s;
var newB = textColor.hsb.b;

var id792 = charIDToTypeID( "Mk " );
var desc154 = new ActionDescriptor();
var id793 = charIDToTypeID( "null" );
var ref129 = new ActionReference();
var id794 = charIDToTypeID( "Clrs" );
ref129.putClass( id794 );
desc154.putReference( id793, ref129 );
var id795 = charIDToTypeID( "Usng" );
var desc155 = new ActionDescriptor();
var id796 = charIDToTypeID( "Nm " );
desc155.putString( id796, ebName);
var id797 = charIDToTypeID( "Clr " );
var desc156 = new ActionDescriptor();
var id798 = charIDToTypeID( "H " );
var id799 = charIDToTypeID( "#Ang" );
desc156.putUnitDouble( id798, id799, newH);
var id800 = charIDToTypeID( "Strt" );
desc156.putDouble( id800, newS );
var id801 = charIDToTypeID( "Brgh" );
desc156.putDouble( id801, newB);
var id802 = charIDToTypeID( "HSBC" );
desc155.putObject( id797, id802, desc156 );
var id803 = charIDToTypeID( "Clrs" );
desc154.putObject( id795, id803, desc155 );
executeAction( id792, desc154, DialogModes.NO );
}
}
}


(Dieser Beitrag wurde von jekyll am 1. Dez 2006, 16:29 geändert)
Änderungsverlauf:
Beitrag geändert von jekyll (Veteran) am 1. Dez 2006, 16:29