home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / System Software / System Extensions / AppleScript Beta / Example Scripts / Example Scripts (as text) / Quill Scripts / Tile Windows < prev    next >
Encoding:
Text File  |  1992-12-02  |  1.1 KB  |  30 lines  |  [TEXT/ToyS]

  1. set fudge to 20 -- the bounds does not include the title bar
  2. -- we have to do this because current application doesn't work in a "tell enclosure"
  3. set currentApp to it
  4. set numWindows to window count
  5. copy bounds of window 1 to enclosure
  6. -- enclosure is a list { left, top, right, bottom }
  7. tell enclosure
  8.     -- here we are telling a list, so all items are below are references to the bounds
  9.     copy item 1 to leftSide
  10.     set accrossTop to (numWindows ^ 0.5) as integer
  11.     set accrossSide to (numWindows ÷ accrossTop + 0.49) as integer
  12.     set width to ((item 3) - (item 1)) div accrossTop
  13.     set height to ((item 4) - (item 2)) div accrossSide - fudge
  14.     repeat with i from 1 to numWindows
  15.         -- first we set up the bounds to include the tiled window size
  16.         copy (item 1) + width to item 3
  17.         copy (item 2) + height to item 4
  18.         -- then we set the window region
  19.         set bounds of window i of currentApp to enclosure
  20.         if i mod accrossTop ≠ 0 then
  21.             -- move to the  right
  22.             set item 1 to (item 1) + width
  23.         else
  24.             -- move  down to next row
  25.             set item 1 to leftSide
  26.             set item 2 to (item 2) + height + fudge
  27.         end if
  28.     end repeat
  29. end tell
  30.