DocD Property Use

4 views
Skip to first unread message

Rich F

unread,
Dec 12, 2011, 3:37:08 PM12/12/11
to BBEdit Talk
Hi folks.

Trying to open 3 text windows vertically on a large monitor, with no
drawers. I was told that the DocD property is the property to set,
but not sure how this would be done. Getting properties doesn't show
anything for this new text window for DocD.

Any insight helpful.

Cheers

Rich Siegel

unread,
Dec 12, 2011, 3:43:21 PM12/12/11
to bbe...@googlegroups.com
On Monday, December 12, 2011, Rich F
<li...@viaduct-productions.com> wrote:

>Trying to open 3 text windows vertically on a large monitor, with no
>drawers. I was told that the DocD property is the property to set,
>but not sure how this would be done. Getting properties doesn't show
>anything for this new text window for DocD.

That's the four-character code for the property in the
terminology. In English, it's "files visible".

Enjoy,

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Christopher Stone

unread,
Dec 12, 2011, 5:21:17 PM12/12/11
to bbe...@googlegroups.com
On Dec 12, 2011, at 14:37, Rich F wrote:
Trying to open 3 text windows vertically on a large monitor, with no drawers. I was told that the DocD property is the property to set, but not sure how this would be done. Getting properties doesn't show anything for this new text window for DocD.
______________________________________________________________________

Hey Rich,

You're trying to script this?

You want the script to open new text windows?  Or the 3 frontmost existing text windows?

Uncomment the loop if you want the script to create the windows.

try
  tell application "Finder"
    set screenBounds to bounds of window of desktop
  end tell

  

  set item 2 of screenBounds to 44
  set {x1, y1, x2, y2} to screenBounds
  set splitScreen to x2 div 3
  set winBoundsList to {}
  repeat with i from 0 to 2
    set end of winBoundsList to {x1 + (i * splitScreen), y1, x1 + ((i + 1) * splitScreen), y2}
  end repeat

  

  tell application "BBEdit"

    

    #     repeat with i from 1 to 3
    #       make new text document
    #     end repeat

    

    if (count of windows) ≥ 3 then
      set winList to name of windows 1 thru 3
      set AppleScript's text item delimiters to return
      set winList to winList as string
      set winList to sort lines winList
      set winList to text items of winList
      repeat with i from 1 to 3
        tell window (item i of winList)
          set files visible to false
          set bounds to (item i of winBoundsList)
        end tell
      end repeat
    end if
  end tell
on error errMsg number errNum
  set {cr, sep} to {return, "------------------------------------------"}
  set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: " & errNum & cr & sep
  beep
  display dialog e
end try

--
Best Regards,
Chris

Viaduct Productions

unread,
Dec 12, 2011, 8:56:30 PM12/12/11
to bbe...@googlegroups.com
Thanks, Rich. I'll give it a whirl and post what I find. Maybe…pie.


On 2011-12-12, at 3:43 PM, Rich Siegel wrote:

> That's the four-character code for the property in the terminology. In English, it's "files visible".

_____________
Rich in Toronto

Viaduct Productions

unread,
Dec 13, 2011, 12:20:31 AM12/13/11
to bbe...@googlegroups.com
Hi Chris. Thanks for the reply. I hope you don't mind the top posting.

Yep, I'd like to have a script that creates three new text windows on my 30" monitor. Problem is, I have two 27" monitors to the left of the target monitor, and another one to the right of the target monitor, all standing vertical. So, the 30 is third in a row. I see that you measure the desktop width then divide it by three. BTW nice approach.

OK, here's what I got to help me:

try
tell application "BBEdit"
close every window
set w to 800
set s to 1
set h to 1560
set c to 5 -- a trip for troubleshooting

(* {1, 45, 800, 1560}, {801, 45, 1601, 1560}, {1602, 45, 2402, 1560} *)
if c = 1 or c = 5 then
set d1 to make new text window
set the bounds of d1 to {1, 45, w, h}
bounds of d1
end if

if c = 2 or c = 5 then
set d2 to make new text window
set the bounds of d2 to {w + s, 45, w + s + w, h}
bounds of d2
end if

if c = 3 or c = 5 then
set d3 to make new text window
set the bounds of d3 to {w + s + w + s, 45, w + s + w + s + w, h}
bounds of d3
end if

set the files visible of every window to "false"
beep


end tell

on error errMsg number errNum
set {cr, sep} to {return, "------------------------------------------"}
set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: " & errNum & cr & sep
beep
display dialog e
end try

I liked your try wrapper. I now have that kept filed away. Excuse the troubleshooting conditionals. My windows weren't rendering properly. I actually spent a long time trying to set the bounds properties only to realize it might have to bet set afterwards. Sometimes it doesn't work.

But this works. Thanks for your post. I will see if I can measure my first finder/desktop window dimensions.

_____________
Rich in Toronto

Christopher Stone

unread,
Dec 13, 2011, 2:32:26 PM12/13/11
to bbe...@googlegroups.com
On Dec 12, 2011, at 23:20, Viaduct Productions wrote:
Yep, I'd like to have a script that creates three new text windows on my 30" monitor.  Problem is, I have two 27" monitors to the left of the target monitor, and another one to the right of the target monitor, all standing vertical.  So, the 30 is third in a row.  I see that you measure the desktop width then divide it by three.  BTW nice approach.  
______________________________________________________________________

Hey Rich,

Nice setup.  :)

The way Applescript handles a multiscreen environment is to return the desktop-window bounds as one big space, so moving and resizing windows by position and bounds can get a little tricky - especially if your setup is prone to changes.  Really kludgy on Apple's part, but it's been this way for years.

Something that may be of use to you:

Change screen resolution on the command line - Mac OS X Hints
http://hints.macworld.com/article.php?story=20110830215724984

--
Best Regards,
Chris

Viaduct Productions

unread,
Dec 13, 2011, 2:43:17 PM12/13/11
to bbe...@googlegroups.com
Oh I know that one. Any change pretty much turns my window scripts to pie.

I've got third party apps to give me general x and y coordinates, then I just mess around with my scripts to make things happy.

Cheers

On 2011-12-13, at 2:32 PM, Christopher Stone wrote:

> Hey Rich,
>
> Nice setup. :)
>
> The way Applescript handles a multiscreen environment is to return the desktop-window bounds as one big space, so moving and resizing windows by position and bounds can get a little tricky - especially if your setup is prone to changes. Really kludgy on Apple's part, but it's been this way for years.
>
> Something that may be of use to you:
>
> Change screen resolution on the command line - Mac OS X Hints
> http://hints.macworld.com/article.php?story=20110830215724984

_____________
Rich in Toronto

Reply all
Reply to author
Forward
0 new messages