Skip to content

Instantly share code, notes, and snippets.

@yoko
Created December 10, 2009 13:00
Show Gist options
  • Save yoko/253316 to your computer and use it in GitHub Desktop.
Save yoko/253316 to your computer and use it in GitHub Desktop.
on url_encode(str)
set ret to do shell script "ruby -e \"require 'uri'; print URI.encode('" & str & "', Regexp.new(\\\"[^#{URI::PATTERN::UNRESERVED}]\\\"))\""
return ret
end url_encode
tell application "BathyScaphe"
set _text to selected text of document 1
set _title to title of document 1
set _url to URL of document 1
end tell
set _text to url_encode(_text)
set _title to url_encode(_title)
set _url to url_encode(_url)
tell application "Safari"
activate
set _tumblr to "http://www.tumblr.com/share?v=3&u=" & _url & "&t=" & _title & "&s=" & _text
open location _tumblr
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment