Advertisement

Article

Send a url in a flash from Safari

Cyril Roger

Cyril Roger

  • Updated:

applescriptWhen a Safari user finds an interesting link that he wants to share with his buddies, what he most likely does is select the ‘Mail Link to this Page’ function in the Safari menu. This normally opens up a new message from the Mac Mail.app and pastes the URL into it. All you have to do is then set a subject and select the email adresses of the people you want to send the URL to.

There are quicker ways by which to send URLs in Safari. One is the keyboard combination of Command Shift + I. This won’t send the email automatically though. Even better, you can install an applescript to make copying and sending a URL a one step process. First, find and open up the AppleScript Utility in Applications. Then copy and paste the following line of code:

tell application "Safari"
set thisPage to URL of document 1
set theSubject to name of document 1
end tell
tell application "Mail"
set theAddress to "Friends@mac.com"
set theBody to "Hey, I thought you would be interested in this link:
" & thisPage
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
set message signature of newMessage to signature "Cheers" -- Cheers being the name of an existing signature already set up in Mail...
tell newMessage
set visible to false
set sender to "yourFromMailAddress@mac.com"
make new to recipient at end of to recipients with properties {address:theAddress}
send
end tell
end tell
end tell

Save it, then use a program like FastScripts or Keyboard Maestro to add a hotkey to the AppleScript. Activating it will take the URL in your Safari browser, open up Mail.app, copy it in the message, add a body text and signature. You can always change the body text, signature and email addresses in the AppleScript. Once set up, sharing URLs with friends will only take the click of a key.

[Via: macosxhints]

Cyril Roger

Cyril Roger

Latest from Cyril Roger

Editorial Guidelines