- Registriert
- 05.01.04
- Beiträge
- 2.109
Hier war schon einmal danach gefragt worden: Fenster maximieren wie das in einem anderen Betriebssystem geht, das wir hier nicht nennen wollen. Nun, nicht unbedingt maximieren, aber wenigstens in der Höhe voll und rechts unter zumindest unter Berücksichtigung der Dockbreite oder auf z.B. 900 Pixel -- je nachdem welche Bildschirmgröße man hat.
Wem das gefällt, der kann es z.B. direkt in Butler einbauen (man kann da ja neuerdings direkt AS-Quellcode drin stehen haben) und dann per heißer Taste (bei mir ^M) aktivieren. Ich find's irre praktisch.
Das ganze Skript ist erstaunlich lang geworden, weil nicht alle Leute das Dock rechts haben
, und weil (natürlich) M$-Programme anders sind…
Ach ja, damit's geht muss "Universal Access>Enable access for assistive devices" (oder wie immer das auf Deutsch heißt) aktiv sein.
Wem das gefällt, der kann es z.B. direkt in Butler einbauen (man kann da ja neuerdings direkt AS-Quellcode drin stehen haben) und dann per heißer Taste (bei mir ^M) aktivieren. Ich find's irre praktisch.
Das ganze Skript ist erstaunlich lang geworden, weil nicht alle Leute das Dock rechts haben

Ach ja, damit's geht muss "Universal Access>Enable access for assistive devices" (oder wie immer das auf Deutsch heißt) aktiv sein.
Code:
-- 2006-02-05 (Nearly) Maximize front window
-- best run from Butler, or Quicksilver for that matter
-- ©2006 Michael Bach <www.michaelbach.de>, building on ideas from many colleagues
-- special treatment for incompatible programs only done for Word so far
-- line below to be customized by you
set rightEdgeOfWindow to -1 -- negative values will set the window to the full screen size (minus Dock)
set rightEdgeOfWindow to 900 -- <—— this will depend on your taste and your display size
-- end of easily customizable part
set menubarHeight to 22
set screenHeight to (word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Height")) as number
set yTop to menubarHeight
set yBottom to screenHeight
set xLeft to 0
set xRight to (word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Width")) as number
tell application "System Events"
set frontProcessName to name of first application process whose frontmost is true
tell list 1 of process "Dock"
set dockOrientation to orientation
set dockPositionRecord to position
set dockSizeRecord to size
end tell
set dockXLeft to (item 1 of dockPositionRecord)
set dockYTop to (item 2 of dockPositionRecord)
set dockWidth to (item 1 of dockSizeRecord)
set dockHeight to (item 2 of dockSizeRecord)
if dockOrientation = "AXHorizontalOrientation" then
set yBottom to yBottom - dockHeight -- need to leave room for dock at bottom
else
if dockOrientation = "AXVerticalOrientation" then
if dockXLeft < 2 then -- dock is at left side of screen
set xLeft to dockWidth
else -- dock is at right side of screen
set xRight to xRight - dockWidth
end if
end if
end if
end tell
if (rightEdgeOfWindow > 0) then set xRight to min(xRight, rightEdgeOfWindow)
if (frontProcessName = "Finder") then set menubarHeight to 44
if (frontProcessName = "Microsoft Word") then
set xLeft to xLeft + 1
set yTop to yTop - 22
tell application "Microsoft Word"
tell window 1
set left position to xLeft
set top to yTop
set width to {xRight - xLeft}
set height to {yBottom - yTop} - 56
end tell
end tell
else
tell application "System Events"
tell process frontProcessName to tell window 1
set position to {xLeft, yTop}
set size to {xRight - xLeft, yBottom - yTop}
end tell
end tell
end if
tell application frontProcessName to activate --back to where we were
--
--
on max(i1, i2) -- I think I don't need this here any more…
if i1 > i2 then return i1
return i2
end max
--
on min(i1, i2)
if i1 < i2 then return i1
return i2
end min