LaunchBar - Import to EagleFiler

Summary: Import text, URLs, or files into EagleFiler.
Requires: EagleFiler, LaunchBar
Install Location: ~/Library/Scripts/Applications/LaunchBar/
Last Modified: 2016-04-14

Description

Save the compiled script as Send to EagleFiler.scpt.

To import text or a URL, begin typing “Send to EagleFiler” to select the script in LaunchBar. Press Space, type your text, and press Return. EagleFiler will create a new rich text file with that text. (If you prefer that EagleFiler create a plain text file, you can edit the script to say import plain text instead of import text.)

To import a file, select the file in LaunchBar, press Tab, begin typing “Send to EagleFiler,” and then press Return.

Set _promptsForTags to false instead of true if you don’t want it to ask you for the tags.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

on handle_string(_string)
    
tell application "EagleFiler"
        
repeat until (exists library document 1)
            
delay 1
        
end repeat
        
tell library document 1
            
if (_string begins with "http://") or (_string begins with "https://") then
                
import URLs {_string} tag names my promptForTags()
            
else
                
import text _string tag names my promptForTags()
            
end if
        
end tell
    
end tell
end handle_string

on open _files
    
tell application "EagleFiler"
        
tell library document 1
            
import files _files tag names my promptForTags()
        
end tell
    
end tell
end open

on promptForTags()
    
set _promptsForTags to true
    
set _tagNames to {"unread"}
    
if not _promptsForTags then return _tagNames
    
set _title to "EagleFiler Import"
    
set _prompt to "Tags (separate multiple tags with spaces):"
    
display dialog _prompt default answer "unread" with title _title
    
set _tagsString to text returned of the result
    
set AppleScript's text item delimiters to " "
    
set _tagNames to text items of _tagsString
    
return _tagNames
end promptForTags