I am working on a project that will automatically print an image that is moved to a folder.
Right now, I have the following working: the image from my camera saves to a folder on my desktop, then applescript opens the image in Photoshop and runs an action on it that resizes it, crops it, and then saves it into a different folder. Here’s where my problem starts…
My printer - an Epson R800 - does not have a default paper size of 5x7 borderless. That selection has to be made in Photoshop, however, Photoshop actions will not capture paper settings. (Which I think is sooooo stupid, but that’s another issue.)
When the image is dropped in the second folder, it currently automatically prints, but on “letter” size paper.
I need to script the following:
Tell Photoshop CS4 to open the image (well, I can do that already!), but then select the correct paper size (5x7 borderless), and print. I’ve tried a few different things and they aren’t working. It doesn’t necessarily HAVE to re-open in Photoshop, it just needs to print with 5x7 borderless as the paper size.
on adding folder items to this_folder after receiving these_items
try
tell application "Finder"
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
tell application "Adobe Photoshop CS4"
open this_item
do action "photoboothResizeAndSave" from "Default Actions"
end tell
on error error_message
tell application "Finder"
display dialog "Error for item " & (this_item as string) ¬
& ": " & error_message buttons {"Continue", "Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end repeat
end tell
on error error_message
tell application "Finder"
display dialog error_message buttons {"Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end adding folder items to
on adding folder items to this_folder after receiving these_items
try
tell application "Finder"
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
set the path_string to this_item as string
set the final_path to POSIX path of the path_string
do shell script "/usr/bin/lp '" & final_path & "'"
on error error_message
tell application "Finder"
display dialog "Error for item " & (this_item as string) ¬
& ": " & error_message buttons {"Continue", "Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end repeat
end tell
on error error_message
tell application "Finder"
display dialog error_message buttons {"Cancel"} ¬
default button 1 giving up after 120
end tell
end try
end adding folder items to
The problem lies in that I can’t set the 5x7 paper size in the action, so I need to do it in the scripting.
I tried this:
tell application "Adobe Photoshop CS4"
open this_item
tell "Page Setup"
set paper size to "5 x 7 in (Sheet Feeder - Borderless)"
end tell
end tell
But I get an error: it highlights “paper size” and says - A property can’t go after this identifier