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: philcozz on Feb 19, '05 04:27:13PM

Actually, I was able to modify it to go from OmniWeb to Entourage... At least this worked for me.

-- ####################
-- # -- eMail tinyURL.scpt --
-- # script to automagically get
-- # and paste a tinyURL from
-- # the active Safari window
-- # into Mail.app.
-- # -- by nekvas 2005
-- # -- http://www.macosxhints.com/article.php?story=200502042003188
-- ####################

-- get the url
tell application "OmniWeb"
set bigURL to the address of browser 1
set theTitle to the name of browser 1
end tell

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

-- pass the value to Mail and put it in the body
tell application "Microsoft Entourage"
activate
set MyMessage to make new draft window with properties ¬
{subject:theTitle, content:tinyURL}
end tell



[ Reply to This | # ]