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: bakalite on Feb 08, '05 12:34:38PM

I tried to modify the script to just past the tiny url to the clipboard, but it doesn't work. I looked at a few examples of using the clipboard online, and can't figure out why it doesn't work. I guess this is the reason I don't code...


[code]
-- ####################
-- # -- eMail tinyURL.scpt --
-- # script to automagically get
-- # and paste a tinyURL from
-- # the active Safari window
-- # into Mail.app.
-- # -- by nekvas 2005
-- ####################

-- get the url
tell application "Safari"
set bigURL to the URL of document 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

--put the result on the clipboard
set clipboard to tinyURL as text
[/code]



[ Reply to This | # ]
Automatically send a TinyURL from Safari via Mail.app
Authored by: luhmann on Feb 08, '05 05:50:56PM

Anyone know how to make this work with OmniWeb? I tried changing "safari" to "omniweb" but no luck.



[ Reply to This | # ]
TinyURL for OmniWeb
Authored by: Krioni on Feb 11, '05 11:09:59AM
Just change the Safari section to:

tell application "OmniWeb"
	set bigURL to address of browser 1
end tell
I didn't see if any other improvements could be made to the script, but that would let it work with OmniWeb. I'd just use the bookmarklet another poster in this thread described. There are a lot of fun things you can do with TinyURL.

[ Reply to This | # ]
TinyURL for OmniWeb
Authored by: Krioni on Feb 11, '05 11:18:34AM

Oops, I posted much too late - obviously others already posted this.



[ Reply to This | # ]