/ Published in: AppleScript

You need to replace [replace_with_bitly_username] and [replace_with_bitly_api_key] to make this snippet work. Test in AppleScript code editor if you're experiencing problems in TextEpander such as the snipped being output instead of the bit.ly URL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
set the ClipURL to (the clipboard as string) ignoring case if ((characters 1 through 4 of ClipURL as string) is not "http") then return "Malformed URL." else set curlCMD to ¬ "curl --stderr /dev/null \"http://bit.ly/api?url=" & ClipURL & "&login=[replace_with_bitly_username]&apiKey=[replace_with_bitly_api_key]" & "\"" -- Run the script and get the result: set tinyURL to (do shell script curlCMD) return tinyURL end if end ignoring
Comments
