Open Tweet in Browser

Summary: Opens the selected tweet in the default Web browser.
Requires: Hibari
Suggested Key Binding: Command-Option-B (like in NetNewsWire)
Install Location: ~/Library/Scripts/Applications/Hibari/
Last Modified: 2019-10-02

Description

This script uses GUI scripting and Hibari’s “Copy Tweet URL” command to add a command that opens the tweet in your browser. It tries to preserve your clipboard contents, but this may not always work perfectly due to limitations of AppleScript.

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

Script

my openTweetInBrowser()

on openTweetInBrowser()
    
set _oldClipboard to get the clipboard
    
my copyHibariTweetURL()
    
delay 1 -- otherwise clipboard may have stale value
    
set _url to get the clipboard
    
set the clipboard to _oldClipboard
    
my openURL(_url)
end openTweetInBrowser

on copyHibariTweetURL()
    
tell application "System Events"
        
tell application process "Hibari"
            
tell menu bar 1
                
tell menu bar item "Tweets"
                    
tell menu 1
                        
tell menu item "Copy Tweet URL"
                            
click
                        
end tell
                    
end tell
                
end tell
            
end tell
        
end tell
    
end tell
end copyHibariTweetURL

on openURL(_url)
    
do shell script "open " & _url's quoted form
end openURL