• 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: System Events: Selecting Text in the Body of a Mail Message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events: Selecting Text in the Body of a Mail Message


  • Subject: Re: System Events: Selecting Text in the Body of a Mail Message
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 10 Oct 2014 19:30:11 -0500

On Oct 10, 2014, at 00:19, Christopher Stone <email@hidden> wrote:
Thus far I'm not having any luck selecting the text in the body of an outgoing message in Mail.
______________________________________________________________________

Hey Folks,

Well.  I haven't managed to select the text, but at least I've figured out how to move the focus into the outgoing message body.

--------------------------------------------------------------
tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0
  tell application process "Mail"
    tell front window
      tell UI element 1 of scroll area 1
        set focused to true
      end tell
    end tell
  end tell
end tell
--------------------------------------------------------------

This solves my immediate problem which was to improve the reliability of a Keyboard Maestro macro.

I'd still like to know how to set the value of the message body using System Events if it's possible.  (Directly - not with keystrokes.)

I know how to get the text if it exists, and that's quite useful for some other workflows.

--------------------------------------------------------------
tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0
  tell application process "Mail"
    tell front window
      tell UI element 1 of scroll area 1
        set AppleScript's text item delimiters to linefeed
        set messageBodyText to (value of static text of groups) as text
      end tell
    end tell
  end tell
end tell
--------------------------------------------------------------

--
Best Regards,
Chris

--------------------------------------------------------------------------------------
Tags: @AppleScript, @System_Events, @System, @Events, @UI-Scripting, @Mail, @Outgoing,
    : @Message, @Focused
--------------------------------------------------------------------------------------

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

This email sent to email@hidden

References: 
 >System Events: Selecting Text in the Body of a Mail Message (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Scripting mail attachments in Yosemite
  • Next by Date: Sending Key Commands?
  • Previous by thread: System Events: Selecting Text in the Body of a Mail Message
  • Next by thread: Scale & watermark images using a script in TextWranlger
  • Index(es):
    • Date
    • Thread