Skip to content

Instantly share code, notes, and snippets.

@oki
Created December 17, 2009 22:35
Show Gist options
  • Select an option

  • Save oki/259092 to your computer and use it in GitHub Desktop.

Select an option

Save oki/259092 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