We are attempting to be able to send out email proofs from our stationery business and are looking for a solution that will help automate the process.
Basically what we are looking for is a solution that will require the typesetter to input a name into a prompt and that name will automatically become the filename of the screen capture and send it off to a designated network folder.
Does this solution currently exist? Is it something someone could help me through?
Built into the system: see man screencapture. The following will create a png file on your desktop (for illustration) of the contents of a window (-W) in interactive mode (the added i). When you run it, the cursor turns to a camera and when you click over a window its contents are captured:
-- set Dest to choose folder
set Ttl to (text returned of (display dialog "Choose a name for the output file. A .png extension will be added so do not include an extension." default answer "ScreenShot")) & ".png"
set Dest to ((path to desktop folder as text) & Ttl)
do shell script "screencapture -Wi " & quoted form of POSIX path of Dest
set target_folder to (path to desktop) as string
set file_name to text returned of (display dialog "Select file title." default answer "") & ".png"
try
do shell script "/usr/sbin/screencapture -x " & ((quoted form of POSIX path of target_folder & file_name) as string)
on error theErr
display dialog theErr
end try
You’d need to set target_folder to the path to your designated network folder.
As screencapture seems to overwrite files without confirmation, you’ll want to check if there is a file of that name beforehand. See the original script for a way to do this.
Did you enter ‘man screencapture’ in the Terminal as Adam suggested?
Try:
set target_folder to (path to desktop) as string
set file_name to text returned of (display dialog "Enter file title." default answer "") & ".png"
try
do shell script "/usr/sbin/screencapture -iW " & ((quoted form of POSIX path of target_folder & file_name) as string)
on error theErr
display dialog theErr
end try
A hot key solution requires a third-party application of which there are many, but only a few are free: see the Keyboard Shortcuts pane of the Keyboard and Mouse system preference for the Apple supplied version. There you can assign a hot key to an application, so you would have to save the script as an application and then wait for it to open and run.
Others include: QuicKeys, QuickSilver (free but a learning curve), FastScripts, LaunchBar. These can launch a script that runs in the background except for dialog boxes, etc. You could also turn it into an Automator Action.
We have run into a problem with this script. It was obviously a problem all along, but we just recently noticed it.
The script we are using is…
set target_folder to ("/Volumes/Invitations-Shared ( 1 )/EMAIL PROOFING/") as string
set file_name to text returned of (display dialog "Enter file title." default answer "") & ".jpg"
try
do shell script "/usr/sbin/screencapture -is " & ((quoted form of POSIX path of target_folder & file_name) as string)
on error theErr
display dialog theErr
end try
I have also used the following terminal command on every computer where this script is being used
defaults write com.apple.screencapture type jpg
Here is the problem
Though we’ve changed the default screencapture type to jpg and the script is telling the file to save with a .jpg extension the file is actually being saved as a PNG. We discovered this because Photoshop doesn’t recognize the file and preview sees it as a PNG even though the extension is JPG
I know the terminal command works because SHIFT+APPLE+4 does result in a legitimate JPG file.