Use a folder action script to manage screenshot files
Oct 18, '04 08:58:00AM • Contributed by: ramonf
Oct 18, '04 08:58:00AM • Contributed by: ramonf
I have been working on a Folder Action Script (view the source) that can be attached to the desktop and will move any snapshot file created with Command-Shift-3 (it does not reliably handle images created with Command-Shift-4) to a "Screen Shots" folder on the desktop, changes the format of the file while adding a preview icon, and renames the file according to the time the snapshot was taken.
One major hurdle that I have not completely overcome, is that folder action scripts cause the front application to come out of focus. My partial solution has been to code everything without using calls to other applications. For example, everything that I would usually do with a tell application "Finder" call, I do using do shell script calls instead.
The other major hurdle was to make sure the PDF picture file that is created on the desktop is non-empty. It seems an empty placeholder is created before the real snapshot is placed on the desktop. This makes the script interfere with the command-shift-4 mechanism. It's also important to make sure it's not being written to. That is what makes things seem sluggish (OS X is not good at updating a file's state; I would imagine to increase performance, right?). I started this script by modifying an Applescript I found in the MacOSXHints forums (Applescript strcmp? by Lankhmart).
I hope it is useful, and that someone more knowledgable can help me improve on the above shortcomings.
[robg adds: A couple of previous hints discuss other methods of handling screenshots.]
One major hurdle that I have not completely overcome, is that folder action scripts cause the front application to come out of focus. My partial solution has been to code everything without using calls to other applications. For example, everything that I would usually do with a tell application "Finder" call, I do using do shell script calls instead.
The other major hurdle was to make sure the PDF picture file that is created on the desktop is non-empty. It seems an empty placeholder is created before the real snapshot is placed on the desktop. This makes the script interfere with the command-shift-4 mechanism. It's also important to make sure it's not being written to. That is what makes things seem sluggish (OS X is not good at updating a file's state; I would imagine to increase performance, right?). I started this script by modifying an Applescript I found in the MacOSXHints forums (Applescript strcmp? by Lankhmart).
I hope it is useful, and that someone more knowledgable can help me improve on the above shortcomings.
[robg adds: A couple of previous hints discuss other methods of handling screenshots.]
•
[9,620 views]
