Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Automatically send a TinyURL from Safari via Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automatically send a TinyURL from Safari via Mail.app
Authored by: DougAdams on Apr 26, '08 02:32:49PM
I modified this script to ask for an URL in a display dialog then display the TinyURL in a second dsiplay dialog, which you can copy from:

-- get the url
set bigURL to text returned of (display dialog "Enter URL to make Tiny:" default answer "")

-- build the command for curl...quoting the url
set curlCMD to ¬
	"curl --stderr /dev/null \"http://tinyurl.com/create.php?url=" & bigURL & "\""

-- grep for tinyurl value
set grepCMD to "| grep 'tinyurl value='"

-- use awk to pull the url out of the retuned page, using " as a delimiter
set awkCMD to "| awk -F'\"' '{ print $2 }'"

-- build the command
set shellCMD to curlCMD & grepCMD & awkCMD

-- run the script and get the result
do shell script shellCMD
set tinyURL to the result
display dialog "Here's the TinyURL:" default answer tinyURL

---
Doug's AppleScripts for iTunes
dougscripts.com

[ Reply to This | # ]