Applescript to launch a URL

K

Kevin_Cossaboon

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel
Email Client: Exchange

I am struggling to write a apple script that will take the highlighted text and open it as a URL in either SAFARI or the default WEB Browser.

I started with the script "Save Selection", but it does not seem to work.

The Line

"set theText to the «class pusl»"

Does not seem to select the text highlighted.

My hope is to fix an issue that Web meetings have the URL in the text of the appointment, but are not a hyper link they are just displayed as plain text http:\\go.here.com

I wanted a script that when I highlighted the text that it would launch SAFARI and go the the URL selected.

Here is my attempt at hacking the "Save Selection...." Script.

-----------------------------------
(*
Save Selection...

Copyright (c) Microsoft Corporation. All rights reserved.

Saves the selection into a text file

* )

on run
set theText to ""

tell current application
activate
try
set theText to the «class pusl»
-- trigger error if no text
if theText is "" then
end if
on error
display dialog ¬
"This script works on text selected in a message." buttons {"OK"}
set theText to ""
end try
end tell

set theText2 to theText as text

try
if theText is not "" then

tell application "Safari"
open location theText
end tell

end if
on error
display dialog "There was an error opening the URL." buttons {"OK"}
end try

end run
 
W

William Smith [MVP]

My hope is to fix an issue that Web meetings have the URL in the text
of the appointment, but are not a hyper link they are just displayed
as plain text http:\\go.here.com

Entourage will open complete URLs when you click them. Complete URLs
look like:

http://www.example.com

Incomplete URLs look like:

www.example.com

Hold the Command key down as you click the incomplete URLs and they
should open in your default web browser.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
E

Ed Kimball

Entourage will open complete URLs when you click them. Complete URLs
look like:

http://www.example.com

Incomplete URLs look like:

www.example.com

Hold the Command key down as you click the incomplete URLs and they
should open in your default web browser.

Hope this helps!
Bill, that's a great tip, thanks.

Kevin, did you also notice how the web link
http://www.example.com/ gets converted into a blue underlined link when the
message is sent, even though it appears as plain text when you are composing
the message?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top