Photoshop CS Help ; |
Photoshop CS Help ; |
- Subject: Photoshop CS Help ; |
- From: Steve Suranie <email@hidden>
- Date: Wed, 30 Mar 2005 15:53:29 -0500
I am working on a script that does the following:
Sets the background color to grey
Opens a file
Changes the mode to RGB
Cuts the content of the background layer and places it on a new layer
Resizes the file
Resizes the canvas
Adds a drop shadow (using styles)
Opens a second file based on a random number between 1 and 4 (first file is
still open)
Copies the contents of a layer of the second file
Closes the second file
Paste the contents of the second file to a new layer of the first file
Selects the contents of the new layer and rotates it
It'll do more but this is as far as I am right now. Problem is when I go to
rotate the contents of the new layer in the first file PS gives me an error
message which reads that the current document contains no selection. But it
clearly does as I have "select all" in the script and if I stop the script
at this point I can go into the PS file and cut, copy, rotate, etc the
contents of the layer I was targeting. I can even cut the contents using AS.
But I can't rotate it.
K-pase-huh?
Any help would be appreciated. Script follows:
=====================================================================
set thePath to (path to desktop as string) & "pictureTest:images:"
set tapePath to (path to desktop as string) & "pictureTest:items:tape"
set theFileList to list folder thePath without invisibles
repeat with thisFile in theFileList
tell application "Adobe Photoshop CS"
set thisFilePath to (thePath as string) & thisFile as alias
activate
set background color to {class:RGB color, red:204, green:204,
blue:204}
open thisFilePath
change mode of current document to RGB
select all of current document
cut selection of current document
make new art layer at beginning of current document with properties
{name:"Image Layer"}
paste selection
--set docRefInfo to info of current document
set theWidth to width of current document
set theHeight to height of current document
if theWidth > theHeight then
resize image of current document width 175 resolution 72
resize canvas of current document width 200 height 200 anchor
position middle center
else
resize image of current document height 175 resolution 72
resize canvas of current document width 200 height 200 anchor
position middle center
end if
set newWidth to width of current document
set newHeight to height of current document
--apply shadow layer style - it's case sensitive
apply layer style art layer "Image Layer" of current document using
"tapeShadow2"
--repeat with i from 1 to 4
--get random number
set thisTapeFile to random number 4
if thisTapeFile = 0 then
set thisTapeFile to thisTapeFile + 1
end if
--subroutine to add tape to page
my tapeTheImage(thisTapeFile, tapePath)
--end repeat
--close current document saving no
end tell
end repeat
---------------------------------------
--Subroutines
---------------------------------------
on tapeTheImage(thisTapeFile, tapePath)
set i to 1
set openThisFile to (tapePath as string) & thisTapeFile & ".psd" as
alias
tell application "Adobe Photoshop CS"
open openThisFile
tell current document
set current layer to layer "tape"
select all
copy
close saving no
end tell
--determining where to put the tape
if i = 1 then
tell current document
paste
set current layer to layer "Layer 1"
select all
rotate selection angle 45
end tell
end if
end tell
end tapeTheImage
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden