Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get selected text of message in Mail?




On 31 Jul 2006, at 02:36, Michelle Steiner wrote:

On Jul 30, 2006, at 5:22 PM, kai wrote:

Thanks, but I found that keystroke "c" using command down fits my needs.

Fine. If it's only for your own use, then losing any existing clipboard contents may not matter that much.

Yup, but if I need to retain those contents, I can always store them in a variable and then restore them to the clipboard.

Which was what the main part of my suggestion sought to do.

For anyone who _may_ be interested, the general-purpose handler below (on which the earlier suggestion was based) is an updated version of one I posted some time back.

----------------

on selected_text from app_name (* Mail, Safari, TextEdit, Address Book, etc. *)
activate application app_name
tell application "System Events" to tell application process app_name
tell menu item "Copy" of menu "Edit" of menu bar item "Edit" of menu bar 1
if not enabled then return ""
set current_clipboard to the clipboard as record
set the clipboard to {}
click
repeat while (the clipboard) is {}
delay 0.1
end repeat
set selected_text to the clipboard
set the clipboard to current_clipboard
end tell
end tell
selected_text
end selected_text


selected_text from "Mail"

----------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Re: get selected text of message in Mail? (From: Michelle Steiner <email@hidden>)
 >Re: get selected text of message in Mail? (From: kai <email@hidden>)
 >Re: get selected text of message in Mail? (From: Michelle Steiner <email@hidden>)
 >Re: get selected text of message in Mail? (From: kai <email@hidden>)
 >Re: get selected text of message in Mail? (From: Michelle Steiner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.