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: jaysoffian on Feb 11, '05 03:01:22PM
And here's a simplfied version:

-- get the url
tell application "Safari"
	set bigURL to the URL of document 1
	set theTitle to the name of document 1
end tell

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

-- run the script and get the result
set tinyURL to do shell script curlCMD

-- pass the value to Mail and put it in the body
tell application "Mail"
	activate
	set this_message to make new outgoing message with properties ¬
		{visible:true, subject:theTitle, content:(return & theTitle & ":" & return & tinyURL & return & return)}
end tell


[ Reply to This | # ]