Last active
December 15, 2015 22:28
-
-
Save ChrisLTD/5332850 to your computer and use it in GitHub Desktop.
Lessn TextExpander Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set api_key to "xxxxxxxxx" | |
set domain to "yourdomain.net" | |
set the longURL to (the clipboard as string) | |
if ((characters 1 through 4 of longURL as string) is not "http") then | |
return "Not a valid URL" | |
else | |
set shellScript to ("curl --url \"http://" & domain & "/-/?api=" & api_key & "&url=" & longURL & "\"") | |
set shortURL to (do shell script shellScript) | |
return shortURL | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment