You can extend EagleFiler’s capture key to support additional applications by adding capture scripts to the folder:
/Users/<username>/Library/Application Support/EagleFiler/Capture Scripts/
(See How can I open the Library folder?.) A capture script is an AppleScript saved in compiled format. The name of the file is of the form <bundle identifier>.scpt, e.g. com.apple.Safari.scpt. You can determine an application’s bundle identifier by finding the CFBundleIdentifier in the Info.plist file inside the application’s package (which you can open using the Show Package Contents command when Control-clicking on the application).
The script should have a handler called capture that returns a list of AppleScript records. Each record in the list should have a |url| key (for a remote http URL) or a |path| key (for a full POSIX path). If no items are available for capture, the script can return the empty list, or it can return a record with a |error| key that provides an application-specific error message.
Other, optional, keys are:
Example: NetNewsWire
The NetNewsWire 3 capture script looks like:
on capture()
tell application "NetNewsWire"
set _tabIndex to index of selected tab
set _tagNames to {}
set _title to ""
set _note to ""
if _tabIndex is 0 then
if exists selectedHeadline then
set _url to URL of selectedHeadline
set _title to title of selectedHeadline
try
get _title
on error
set _title to ""
end try
if isFlagged of selectedHeadline then
set _tagNames to {"flagged"}
end if
else
return {{|error|:"No URL is available to be captured."}}
end if
else
set _urls to URLs of tabs
try
set _url to item (_tabIndex + 1) of _urls
set _titles to titles of tabs
set _title to item (_tabIndex + 1) of _titles
try
set _note to do JavaScript "window.getSelection().toString()"
end try
on error
return {{|error|:"EagleFiler could not access the current tab due to a bug in NetNewsWire. Please try closing any blank tabs."}}
end try
end if
end tell
return {{|url|:_url, tags:_tagNames, title:_title, |note|:_note}}
end capture
Example: Finder
The capture script for the Finder demonstrates how to capture multiple items at once:
on capture()
tell application "Finder"
set theSelection to selection as list
set theResult to {}
repeat with theFile in theSelection
set theFile to theFile as alias
copy {|path|:POSIX path of theFile} to end of theResult
end repeat
return theResult
end tell
end capture