Control Window Size when Opening a Document

479 views
Skip to first unread message

Douglas von Roeder

unread,
Aug 26, 2015, 7:49:22 PM8/26/15
to BBEdit Talk
Using BBEdit 11.1.2 with a MacBook Pro and 27" iMac as an external monitor. When opening a document, BBEdit opens it to the full height of the iMac screen. If I want to move the window to my MBP, I have to manually resize the window. 
Is there a way to restrict the size of a window when it opens? 

Patrick Woolsey

unread,
Aug 26, 2015, 8:14:09 PM8/26/15
to bbe...@googlegroups.com
You can control the default size & position of editing windows
by just creating a new editing window (File -> New -> Text
Window), resizing and/or moving that window to whatever size and
position you prefer, and then selecting Window -> Save Default Window.

Once you have done so, BBEdit will use the specified size &
position as the defaults for all new editing windows.

Next, if you move an editing window from a larger to a smaller
display, BBEdit should automatically 'shrink' that window to fit
entirely into the smaller display.

Last but by no means least :-), if you're familiar with
AppleScript, you can quite readily use it to make further window
positioning refinements.


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com/>

Bruce Linde

unread,
Aug 26, 2015, 8:27:58 PM8/26/15
to BBEdit Talk
douglas -

i have the same setup.

i use dragthing and the following two applescripts for when i’m desk-bound or mobile.

please note that there are no doubt more elegant/simple ways to do this… my coding philosophy has always been ‘hey, it works… STFU!  8-)'

btw… the scripts position all of my windows so i can reconfigure my environment with one click… happy to share other code chunks if you’re interested… bli...@5happy.com

bruce



============================================
when plugged into apple 27" monitor...
============================================

tell application "System Events"
tell process "BBEdit"
repeat with x from 1 to (count windows)
set this_name to (name of window x) as text
--display dialog this_name
if this_name is not "Utilities" and this_name is not "HTML Tools" and this_name is not "Windows" and this_name is not "Entities" and this_name is not "CSS" and this_name is not "Find" and this_name is not "Multi-File Search" and this_name is not "BBEdit Preferences" and this_name is not "System Events" and this_name is not "Clippings" then
tell window x
set position to {135, 21}
set size to {1372, 1078}
end tell
end if
if this_name is "HTML Tools" then
tell window x
set position to {-500, 321}
end tell
end if
end repeat
end tell



============================================
when mobile... when just on mbp
============================================

tell application "BBEdit" to activate
tell application "System Events"
tell process "BBEdit"
repeat with x from 1 to (count windows)
set this_name to (name of window x) as text
--display dialog this_name
if this_name is not "Utilities" and this_name is not "HTML Tools" and this_name is not "Windows" and this_name is not "Entities" and this_name is not "CSS" and this_name is not "Find" and this_name is not "Multi-File Search" and this_name is not "BBEdit Preferences" and this_name is not "System Events" and this_name is not "Clippings" then
tell window x
set position to {11, 21}
set size to {1200, 975}
end tell
end if
end repeat
end tell
end tell









Christopher Stone

unread,
Aug 26, 2015, 10:07:55 PM8/26/15
to BBEdit-Talk Talk
On Aug 26, 2015, at 19:00, Bruce Linde <bli...@5happy.com> wrote:
tell application "System Events"
tell process "BBEdit"
repeat with x from 1 to (count windows)
set this_name to (name of window x) as text
______________________________________________________________________

Hey Bruce,

There's no need to have System Events talk to the BBEdit process, when you can talk to BBEdit directly.

---------------------------------------------
tell application "BBEdit"

  

  tell (project windows whose ¬
    name is not "clipping" and ¬
    name is not "Clippings" and ¬
    name is not "CSS" and ¬
    name is not "Entities" and ¬
    name is not "untitled" and ¬
    name is not "Utilities")

    

    set bounds to {340, 45, 1380, 1196}

    

  end tell

  

  tell palette "HTML Tools"
    if its visible is true then
      set its position to {1781, 39}
    end if
  end tell

  

end tell
---------------------------------------------

This way you can automatically filter out non-project windows and such.

And by changing the formatting a bit you can make it more readable and maintainable.

--
Best Regards,
Chris

Reply all
Reply to author
Forward
0 new messages