Using EagleFiler’s Capture Key From Preview

December 28th, 2009 (EagleFiler)

EagleFiler’s capture key is often the easiest way to get files into EagleFiler. You can just press the F1 key to import the selected items or the frontmost window of the current application. Unfortunately, this does not work in Preview. The capture feature relies on AppleScript, and Preview does not support AppleScript. Macworld wrote an article in 2006 that shows a way to enable AppleScript in Preview. The Terminal commands need to be modified slightly for Mac OS X 10.6 Snow Leopard:

sudo defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES
sudo chmod a+r /Applications/Preview.app/Contents/Info.plist

(The above two commands also work on Mac OS X 10.4 and 10.5.)

This procedure seems to work for lots of people, and we believe it to be safe. However, you should be aware that you are modifying the Preview application to work in a way that Apple did not intend.

Update (2011-07-26): For Mac OS X 10.7 Lion, use these commands:

sudo ditto -c -k --sequesterRsrc --keepParent /Applications/Preview.app /Applications/Preview.app.zip
sudo defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES
sudo chmod a+r /Applications/Preview.app/Contents/Info.plist
sudo codesign -f -s - /Applications/Preview.app

This also saves a ZIP archive of your original copy of Preview, in case you want to go back to the unmodified version.

Update (2012-09-03): For Mac OS X 10.8 Mountain Lion, first install Xcode, a free download from the Mac App Store. Then use these commands:

sudo ditto -c -k --sequesterRsrc --keepParent /Applications/Preview.app /Applications/Preview.app.zip
sudo defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES
sudo chmod a+r /Applications/Preview.app/Contents/Info.plist
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate /usr/bin
sudo codesign -f -s - /Applications/Preview.app

It’s OK if the ln command reports that the “File exists”.

Update (2013-10-24): In Mac OS X 10.9 Mavericks, Preview is scriptable out of the box, so the steps on this page are unnecessary.