You need to replace [replacewithbitlyusername] and [replacewithbitlyapi_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
- 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."
- 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
You need to login to post a comment.