Omniweb applescripting...
Phillip Deackes
phillip at madgestevens.net
Fri Jan 27 09:16:38 PST 2006
What about this one? It's just a script to take the current url, run
it through tinyurl.com which generates a short url, and then passes
it on to Apple Mail.
It was written for Safari and I changed Safari with OmniWeb but it
still doesn't work. I get this error:
The script 'TinyURL' could not complete.
AppleScript reported the following error:
OmniWeb got an error: Can't make «class url » of document 1 into type
reference.
Any ideas?
-- ####################
-- # -- 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 "OmniWeb"
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
-- 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:"check out this page", content:("<" &
tinyURL & ">")}
end tell
--
Phillip Deackes
More information about the OmniWeb-l
mailing list