Put timing code in after each action to output the amount of time spent on each.
I'll leave that exercise up to you.
Welcome to the joy of performance profiling your code :)
Now if any of the items you are setting are properties of an object(a record), you may be able to set those properties directly like so:
set myProps of myThing to {stroke color: theTextColor, fill: theFillColor}
I'd try that in a SIMPLE case to see if that works and then see if you can move that in to your code, but don't forget to identify which lines are slow by doing the manual performance profiling.
Cheers, - Alex On Mar 23, 2011, at 3: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)
--
Ken Fleisher
Color Scientist
Imaging & Visual Services
National Gallery of Art
Washington, D.C.
Phone: (202) 712-7471
email@hidden
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/archives/applescript-users
This email sent to email@hidden
|