• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: get selected text of message in Mail?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get selected text of message in Mail?


  • Subject: Re: get selected text of message in Mail?
  • From: kai <email@hidden>
  • Date: Fri, 2 Sep 2005 09:01:29 +0100


On 2 Sep 2005, at 08:06, Martin Orpen wrote:

on 2/9/05 01:03, Matt Neuburg at email@hidden wrote:


On Wed, 31 Aug 2005 21:57:16 +0100, "Charles Arthur, UKClimbing Editor"
<email@hidden> said:


OK, I can't figure it out. Is it feasible?

In Eudora (where yes, I enjoy changing the subject line... oh, that's
another topic, isn't it?) one can do


set thetext to selected text

and get, well, the text you've selected in whatever message you're looking
at.


However I've found nothing comparable in Mail.

You can get the whole text of a message -
set foo to the selection
set foo to item 1 of foo
set thetext to (content) of foo
(inside a Mail tell block of course)

but things like "selected text of content" don't compile, "selection of
content" doesn't make sense (because "selection" applies to the mail
messages window).


Any way to do this?


No. m.



How about:

activate application "Mail"
tell application "System Events"
tell process "Mail"
get value of attribute "AXSelectedText" of text area 1 of scroll
area 2 of splitter group 1 of window 1
end tell
end tell



Works for me in Tiger :)

Nice one, Martin. :)

Since Mail doesn't have to be frontmost, you could even leave out the activate statement (possibly wrapping the rest in a try block, to cover situations in which Mail isn't running).

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: get selected text of message in Mail?
      • From: Martin Orpen <email@hidden>
References: 
 >Re: get selected text of message in Mail? (From: Martin Orpen <email@hidden>)

  • Prev by Date: Re: get selected text of message in Mail?
  • Next by Date: Re: get selected text of message in Mail?
  • Previous by thread: Re: get selected text of message in Mail?
  • Next by thread: Re: get selected text of message in Mail?
  • Index(es):
    • Date
    • Thread