I’d like to be able to automatically add the ‘Conversation’ button to my Mail toolbar, but cannot work out how to select and drag it there.
Perhaps if I could somehow Command-click on it (which throws up a single item menu), I could then click on the menu item to copy it to the menu bar, but how?
Any advice appreciated.
tell application "Mail"
activate
tell application "System Events" to tell process "Mail"
click menu item "Message Viewer" of menu 1 of menu bar item "Window" of menu bar 1
if not (exists button "No Conversations" of toolbar 1 of window 1) and not (exists button "Conversations" of toolbar 1 of window 1) then
tell current application to delay 0.2
click menu item "Customize Toolbar…" of menu 1 of menu bar item "View" of menu bar 1
tell current application to delay 0.2
# select image 24 of toolbar 1 of sheet 1 of window "2015 06 17 — On My Mac (0 messages)"
#try
tell button "New Message" of toolbar 1 of window 1
set {xNewPosition, yNewPosition} to position
set {xNewSize, yNewSize} to size
end tell
tell image 24 of toolbar 1 of sheet 1 of window 1
set {xPosition, yPosition} to position
set {xSize, ySize} to size
end tell
-- modify offsets if hot spot is not centered:
click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
move image 24 of toolbar 1 of sheet 1 of window 1 to {xNewPosition, yNewPosition}
keystroke return
#end try
end if
end tell
end tell