------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/24 08:05
# dMod: 2015/10/24 08:36
# Appl: Mail, System Events
# Task: Toggle Preview Pane Open/Closed.
# Tags: @Applescript, @Script, @Mail, @System_Events, @Toggle, @Preview, @Pane
------------------------------------------------------------------------------
# Throws error if front window is NOT a message-viewer
tell application "Mail" to some message viewer whose index is 1
------------------------------------------------------------------------------
tell application "System Events"
tell application process "Mail"
set {null, winY} to size of front window
set openValue to winY / 2.75
set closedValue to winY - 10
tell (first window whose subrole is "AXStandardWindow")
tell splitter 1 of splitter group 1 of splitter group 1
if its value is openValue then
set value to closedValue
else if its value is closedValue then
set value to openValue
else
set value to closedValue
end if
end tell
end tell
end tell
end tell
------------------------------------------------------------------------------
I hadn't thought of trying to move the Preview Pane around with System Events. Thanks for steering me in that direction. I used to use my old toggle script a lot, and now I can move the splitter-bar I'll use variations of this one even more.