I am trying to add a miniture corporate logo to a series of images.
set logoize to choose file
set thelogo to "path:to:logo:file.psd" as alias
tell application "Finder"
set thefilename to the name of logoize
set thelogoname to the name of thelogo
end tell
tell application "Adobe Photoshop CS"
set ruler units of settings to pixel units
set display dialogs to never
if exists document thelogoname then
else
open thelogo
end if
open logoize
tell document thefilename
set this_info to the info
set originalresolution to the resolution
if originalresolution > 72 then
resize image resolution 72 resample method none
end if
set originalwidth to the width
set originalheight to the height
if originalwidth > originalheight then
if originalwidth > 1024 then
resize image width 1024
resize canvas height 768
end if
else
if originalheight > 768 then
resize image height 768
resize canvas width 1024
end if
end if
set originalmode to mode
if originalmode is not RGB then
convert color to RGB
end if
end tell
tell document thelogoname
select all
copy
end tell
end tell
The problem is that PhotoShop won’t let me select from any document that isn’t the frontmost document. I keep getting the error:
Adobe Photoshop CS got an error: The requested action requires that the target document is the frontmost document.
I can’t find any documentation on how to switch which document is the frontmost document. Anyone know?