The Script:
|
property OriginalWindowBounds : {}
property FullScreenBounds : {}
try
if FullScreenBounds is {} then
tell application "Finder" to copy bounds of desktop's window to screenSize -- Remember: {left, top, right, bottom}
set FullScreenBounds to {(item 1 of screenSize) + 2, 41, (item 3 of screenSize) - 1, (item 4 of screenSize) - 1} -- adjust to your needs
end if
tell application "BBEdit 6.0"
if exists window 1 then -- only proceed if there's any open document...
set CurrentWindowBounds to bounds of window 1
if CurrentWindowBounds = FullScreenBounds then -- window is currently zoomed to full screen
set bounds of window 1 to OriginalWindowBounds -- restore original window bounds
else -- window is currently NOT zoomed to full screen
set OriginalWindowBounds to bounds of window 1 -- save original window bounds
set bounds of window 1 to FullScreenBounds -- zoom window to full screen
-- since BBEdit 6 resizes any window zoomed over its own values defining "full screen"
-- we've to re-assign the FullScreenBounds:
set FullScreenBounds to bounds of window 1
end if
else
display dialog "No open text window!" with icon caution buttons "Oops" default button 1
end if
end tell
on error errMsg number errNo
if errNo is not -128 then -- error # -128: user canceled
set FullScreenBounds to {}
display dialog "An error has occurred:" & return & return & ¬
errMsg & return & "(error No: " & errNo & ")" with icon caution buttons "OK" default button 1
end if
end try
|