Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to email Safari URLs with titles via Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to email Safari URLs with titles via Mail
Authored by: fm on Mar 21, '03 11:19:41AM

Note that you do not need to use text item delimiters and conversion between text and list to get the title of a document.

Since Safari puts the document title on document's window title bar, you can get the title with "name of <window reference>".

So, this is the script I use:

tell application "Safari"
set w to front window
set theSubject to name of w
set theURL to URL of document of w
end tell

tell application "Mail"
activate
set newMsg to (make new outgoing message with properties {visible:true, content:theURL, subject:theSubject})
-- code for setting other message properties here
end tell



[ Reply to This | # ]
Summarize
Authored by: Brontojoris on May 27, '03 11:05:40AM

This version will get Summarize the webpage text too.

tell application "Safari"
ignoring case
set theURL to URL of front document
set theTitle to name of front window
set theText to text of front document
set theDocSummary to summarize theText in 4
end ignoring
end tell

tell application "Mail"
set accountAddresses to (email addresses of first account)
set fromAddress to first item of accountAddresses
set theMessage to make new outgoing message
set visible of theMessage to true
set subject of theMessage to theTitle
set content of theMessage to theDocSummary & "

" & theURL
activate
end tell



[ Reply to This | # ]
An AppleScript to email Safari URLs with titles via Mail
Authored by: lrosenstein on Aug 13, '03 06:04:55PM

You can also get the document title with JavaScript:

tell application "Safari"
set doc to a reference to document 1
set page_title to do JavaScript "document.title" in doc
end tell

The same goes for the selected text (using "getSelection()"), which is what I like to do.



[ Reply to This | # ]