TextMate için yaptığım küçük bir AppleScript
TextMate için yaptığım küçük bir AppleScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run | |
tell application "Finder" | |
set DesktopSize to bounds of window of desktop | |
set DesktopWidth to item 3 of DesktopSize | |
set DesktopHeight to item 4 of DesktopSize | |
end tell | |
tell application "TextMate" | |
activate | |
set WindowsList to (every window where visible is true) | |
set n to count of WindowsList | |
if n = 1 then return | |
if n > 4 then | |
say "sorry, max 4" | |
return | |
end if | |
set blockSize to DesktopWidth / 3 | |
set blockSizeW to DesktopWidth / 2 | |
set blockSizeH to DesktopHeight / 2 | |
if n = 2 then | |
set the bounds of the first window to {0, 0, blockSizeW, DesktopHeight} | |
set the bounds of the second window to {blockSizeW, 0, DesktopWidth, DesktopHeight} | |
end if | |
if n = 3 then | |
set the bounds of the first window to {0, 0, blockSize, DesktopHeight} | |
set the bounds of the second window to {blockSize, 0, (blockSize * 2), DesktopHeight} | |
set the bounds of the third window to {(blockSize * 2), 0, DesktopWidth, DesktopHeight} | |
end if | |
if n = 4 then | |
set the bounds of the first window to {0, 0, blockSizeW, blockSizeH} | |
set the bounds of the second window to {blockSizeW, 0, DesktopWidth, blockSizeH} | |
set the bounds of the third window to {0, blockSizeH, blockSizeW, DesktopHeight} | |
set the bounds of the fourth window to {blockSizeW, blockSizeH, DesktopWidth, DesktopHeight} | |
end if | |
end tell | |
end run |