views:

56

answers:

1

Is it possible for me to listen to listen to OSX's built in screencapturing so I can handle the files myself rather than osx doing it?

+4  A: 

There are a few options.

  1. Just use Ctrl-Cmd-Shift-3 or 4 instead of Cmd-Shift-3 or 4. This does not save the file to the desktop, instead it saves the data in the clipboard/pasteboard. I don't know where's the official mention of this, but here is one. Then you can get the data through NSPasteboard, see here.

  2. You can use FSEvents to be notified whenever a file is created in a specified folder. Then you can rename the screenshot file soon after it was saved to the desktop by the system. Note that the file name of the screenshot depends on the language environment you choose in System Preferences. So, be very careful if you want to make your program work on a non-English machine.

  3. If you just programmatically take the screenshot, you can use the command line tool screencapture, see the man page.

  4. Of course you can hack into the system and take over the handling of Cmd-Shift-3,4, as Snapz Pro does, for example. You know what you're doing if you choose that way.

Yuji
Option #1 seems best to me too.
Leibowitzn