Return to Snippet

Revision: 31864
at September 14, 2010 22:24 by nick108


Initial Code
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

Initial URL


Initial Description
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

Initial Title
TextExpander bit.ly

Initial Tags


Initial Language
AppleScript