Jump to content

Change focus to Body section of front most Compose window in Apple Mail


Recommended Posts

I find it cumbersome to move to the Body section of a new message in Apple Mail.

 

Sure, you can use Tab to move through the fields of the window, but if you have Full Keyboard Access on, that can be many. You may also often add cc: and bcc: which also alters how many presses of Tab are required to land in the body section. Also, if you Tab too many times then you start adding tab characters in your email. Argh!

 

So, I wanted to find a way to instantly focus the body section.

 

I used Apple's Accessibility Inspector (comes as part of Xcode) to find out the UI element I needed to target, and the property I needed to change to apply focus. Then it was just a mater of a few lines of AppleScript.

 

Here it is, wrapped in a workflow that can be summoned by a hotkey. I chose Cmd+` but you can configure it to your liking.

 

Download: Focus Body.alfredworkflow (2013-08-29)

 

AppleScript:

tell application "System Events"
	tell process "Mail"
		set value of attribute "AXFocused" of UI element 1 of scroll area 4 of front window to true
	end tell
end tell

Edited by gingerbeardman
Link to comment
  • 3 weeks later...

Added Focus Subject which works in a similar way to focus the Subject field.

 

or switch:

 

activate application "Mail"

tell application "System Events"

tell process "Mail"

if title of window 1 does not contain "Inbox" then

if value of attribute "AXFocused" of text field 1 of front window is true then

set value of attribute "AXFocused" of UI element 1 of scroll area 4 of front window to true

else

set value of attribute "AXFocused" of text field 1 of front window to true

end if

end if

end tell

end tell

Edited by dirk
Link to comment
  • 2 weeks later...
  • 1 month later...
  • 2 years later...

Hey Gingerbeardman --- I sent a pm re: this script. Currently not working on my end, likely a PICNIC problem. Would love to pick your ear if you have a few minutes. Thanks!

 

 

Hi Cory, could you please fill in your Powerpack email address in your forum profile before taking part in Powerpack-related discussions? Thanks!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...