Re: PS CS art layer solid fill
Re: PS CS art layer solid fill
- Subject: Re: PS CS art layer solid fill
- From: Stan Cleveland <email@hidden>
- Date: Thu, 18 Jan 2007 16:12:42 -0800
- Thread-topic: PS CS art layer solid fill
Title: Re: PS CS art layer solid fill
On 1/18/07 3:59 PM, Martin Orpen wrote:
> Use _javascript_:
>
>
> tell application "Adobe Photoshop CS3"
> activate
> do _javascript_ "var id115 = charIDToTypeID( \"Mk \" );
> var desc21 = new ActionDescriptor();
> var id116 = charIDToTypeID( \"null\" );
> var ref8 = new ActionReference();
> var id117 = stringIDToTypeID( \"contentLayer\" );
> ref8.putClass( id117 );
> desc21.putReference( id116, ref8 );
> var id118 = charIDToTypeID( \"Usng\" );
> var desc22 = new ActionDescriptor();
> var id119 = charIDToTypeID( \"Type\" );
> var desc23 = new ActionDescriptor();
> var id120 = charIDToTypeID( \"Clr \" );
> var desc24 = new ActionDescriptor();
> var id121 = charIDToTypeID( \"Rd \" );
> desc24.putDouble( id121, 9.999847 );
> var id122 = charIDToTypeID( \"Grn \" );
> desc24.putDouble( id122, 39.999390 );
> var id123 = charIDToTypeID( \"Bl \" );
> desc24.putDouble( id123, 49.999237 );
> var id124 = charIDToTypeID( \"RGBC\" );
> desc23.putObject( id120, id124, desc24 );
> var id125 = stringIDToTypeID( \"solidColorLayer\" );
> desc22.putObject( id119, id125, desc23 );
> var id126 = stringIDToTypeID( \"contentLayer\" );
> desc21.putObject( id118, id126, desc22 );
> executeAction( id115, desc21, DialogModes.NO );"
> end tell
Martin, you beat me to it. However, this version in an AppleScript handler might be a bit less mystifying and easier to implement:
set newLayer to makeSolidColorFillLayer(25, 150, 100) -- rgb values
on makeSolidColorFillLayer(redVal, grnVal, bluVal)
tell application "Adobe Photoshop CS"
do _javascript_ ("function newSolidColorFillLayer( myL, myA, myB )
{
var layerTypeRef = new ActionReference();
layerTypeRef.putClass( stringIDToTypeID( \"contentLayer\" ) );
var newFillLayer = new ActionDescriptor();
newFillLayer.putReference( charIDToTypeID( \"null\" ) , layerTypeRef );
var colorValues = new ActionDescriptor();
colorValues.putDouble( charIDToTypeID( \"Rd \" ) , " & redVal & " );
colorValues.putDouble( charIDToTypeID( \"Grn \" ) , " & grnVal & " );
colorValues.putDouble( charIDToTypeID( \"Bl \" ) , " & bluVal & " );
var rgbColor = new ActionDescriptor();
rgbColor.putObject( charIDToTypeID( \"Clr \" ) , charIDToTypeID( \"RGBC\" ) , colorValues );
var fillType = new ActionDescriptor();
fillType.putObject( charIDToTypeID( \"Type\" ) , stringIDToTypeID( \"solidColorLayer\" ) , rgbColor );
newFillLayer.putObject( charIDToTypeID( \"Usng\" ) , stringIDToTypeID( \"contentLayer\" ) , fillType );
executeAction( charIDToTypeID( \"Mk \" ) , newFillLayer, DialogModes.NO );
}
newSolidColorFillLayer( arguments[0] , arguments[1] , arguments[2] );") ¬
with arguments {redVal, grnVal, bluVal}
return name of current layer of current document
end tell
end makeSolidColorFillLayer
_javascript_ is THE way to script things in Photoshop CS/CS2/CS3 that can’t be done with AppleScript otherwise.
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden