On Dec 5, 2008, at 3:13 PM, Bruce Van Allen wrote:
> Oops -- on further tests, I'm getting inconsistent results from
> Save Default Window in BBEdit 9.0.2, with or without a Menu key
> or script, and I've reported it to BB support
Here's what I think is happening (at least in 8.7.2; don't have 9
yet): when Quit is invoked, other GUI handling is suspended, so GUI
scripting doesn't work from a Quit-attached menu script. The following
script will set the default window size when run from Script Editor or
elsewhere (e.g. compiled script from BBEdit's script menu):
tell application "BBEdit"
activate
end tell
tell application "System Events"
tell process "BBEdit"
tell menu bar 1
tell menu bar item "Window"
tell menu "Window"
click menu item "Save Default Window"
end tell
end tell
end tell
end tell
end tell
The same script, wrapped in appropriate menuselect handlers and
returning false so BBEdit follows through with the quit, doesn't work
(note also it has to be saved as "BBEdit•Quit", not "BBEdit•Quit
BBEdit"):
on MenuSelect(menuname, itemname)
tell application "BBEdit"
activate
end tell
tell application "System Events"
tell process "BBEdit"
tell menu bar 1
tell menu bar item "Window"
tell menu "Window"
click menu item "Save Default
Window"
end tell
end tell
end tell
end tell
end tell
return false
end MenuSelect
A possible kludge, depending on the OP's tolerance for kludges, is to
save the first script above as a BBEdit Startup Item, then set the
preferences "Do nothing" at startup and "Reopen documents that were
open at last quit", while *not* setting "honor saved state" for window
position. This should open the last document (even an empty/untitled
window) where it was when BBEdit was quit, and save that as the
default window size/position, to be used for subsequent new windows.
Not sure it's worth the effort, and there may be cases it doesn't
cover, but it seems that would do what he wants.
- Todd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or
confirmed) problem with the software, please email to "[EMAIL PROTECTED]"
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---