home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-02 | 1.1 KB | 30 lines | [TEXT/ToyS] |
- set fudge to 20 -- the bounds does not include the title bar
- -- we have to do this because current application doesn't work in a "tell enclosure"
- set currentApp to it
- set numWindows to window count
- copy bounds of window 1 to enclosure
- -- enclosure is a list { left, top, right, bottom }
- tell enclosure
- -- here we are telling a list, so all items are below are references to the bounds
- copy item 1 to leftSide
- set accrossTop to (numWindows ^ 0.5) as integer
- set accrossSide to (numWindows ÷ accrossTop + 0.49) as integer
- set width to ((item 3) - (item 1)) div accrossTop
- set height to ((item 4) - (item 2)) div accrossSide - fudge
- repeat with i from 1 to numWindows
- -- first we set up the bounds to include the tiled window size
- copy (item 1) + width to item 3
- copy (item 2) + height to item 4
- -- then we set the window region
- set bounds of window i of currentApp to enclosure
- if i mod accrossTop ≠ 0 then
- -- move to the right
- set item 1 to (item 1) + width
- else
- -- move down to next row
- set item 1 to leftSide
- set item 2 to (item 2) + height + fudge
- end if
- end repeat
- end tell
-