Skip to content

Instantly share code, notes, and snippets.

@justin
Created March 15, 2010 14:17
Show Gist options
  • Save justin/332866 to your computer and use it in GitHub Desktop.
Save justin/332866 to your computer and use it in GitHub Desktop.
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://tinyurl.com/api-create.php?url=" & ClipURL & "\""
-- Run the script and get the result:
set tinyURL to (do shell script curlCMD)
return tinyURL
end if
end ignoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment