Open in BBEdit

Summary: Open the selected items in BBEdit.
Requires: BBEdit
Suggested Key Binding: Command-Shift-B
Install Location: ~/Library/Scripts/Applications/Finder/
Last Modified: 2019-10-02

Description

Opens text windows in BBEdit for the selected files and disk browsers for the selected folders. I recommend saving the script as an application, giving it a BBEdit-like icon, and setting LSUIElement to 1 in the Info.plist.

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

Script

on run
    
tell application "Finder"
        
set _list to {}
        
set _items to selection
        
if _items is {} then
            
set _folder to folder of the front window as string
            
copy _folder to end of _list
        
else
            
repeat with _item in _items
                
set _item to _item as alias
                
copy _item to end of _list
            
end repeat
        
end if
    
end tell
    
bb(_list)
end run

on open (_list)
    
bb(_list)
end open


on bb(_list)
    
tell application "BBEdit"
        
open _list
        
activate
    
end tell
end bb