On Mar 23, 2011, at 1:22 PM, Fleisher, Ken wrote:
I have an applescript that creates text layers in Photoshop CS5. The script works, but when creating text layers, it becomes very slow. Every property is set on an individual line. I have not found a way to set all properties and create the text layer in a single action, or even to just set multiple properties in a single command. Is this possible, or do I need to do it as in my example code below? Thanks in advance for any advice you can provide.
Ken
set filelayerref to make new art layer at captionGroup with properties {kind:text layer, name:"Filename_caption"}
set filenameref to text object of filelayerref
set justification of filenameref to left
set contents of contents of filenameref to captionname of pashuaResult
set size of filenameref to 10
set stroke color of filenameref to thetextcolor
set font of filenameref to "Helvetica"
set position of contents of filenameref to {10, (h - 50)}
set thedimensions to get (bounds of filelayerref) as list
set fileNameW to (item 3 of thedimensions) - (item 1 of thedimensions)
Hi Ken,
You're right. Any time you can combine operations, it's a good thing.
Without actually testing it, though based on past experience, I would guess that the following (or something close to it) will work to replace the first eight lines of your code:
set filelayerref to make new art layer at captionGroup with properties ¬ {kind:text layer, name:"Filename_caption", text object:{justification:left ¬ , size:10, stroke color:thetextcolor, font:"Helvetica", contents:¬ {contents:captionname of pashuaResult, position:{10, (h - 50)}}}}
With fingers crossed, Stan C.
|