Feb/10 0
comments
Switch101 – MacOS Fenster auf Knopfdruck maximieren
Wie schalte ich das aktive Fenster unter MacOS auf Knopfdruck in den Vollbildmodus? Oder genauer: Wie sage ich dem aktiven Fenster, daß es die maximal mögliche Bildschirmfläche zur Anzeige nutzen soll? Das ist es nämlich genau das, was das kleine grüne Knöpfchen aus der ampelfarbenen Buttonleiste jedes Mac-Fensters tut. Allerdings nur, wenn es mit der Maus geklickt wird. Von Haus aus bietet MacOS keinen Tastatur-Shortcut, um diese Funktion aufzurufen.
Mit ein wenig Applescript und einem Tool, daß Hotkey-gesteuert Apple-Skripte starten oder ausführen kann, lässt sich jedoch Abhilfe schaffen. Wir zeigen einen Lösungsweg mit dem sehr mächtigen Productivity Tool Butler
von Peter Maurer. Das Tool ist kostenlos und bietet unzählige Möglichkeiten auf die diese Guided Tour
neugierig machten könnte.
So geht’s: In Customize-Dialog von Butler ein neues Smart Item “AppleScript” im Hidden-Bereich anlegen. Gewünschten Hotkey im Triggers-Tab wählen. Abschließend den folgenden Kode per Cut’n'Paste in das Source Code-Tab einfügen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | -- A script to automatically zoom the frontmost window. -- © 2006 by Daniel Jalkut, Inspired by: -- http://www.macosxhints.com/article.php?story=20051227001809626&lsrc=osxh tell application "System Events" set frontAppName to name of first application process whose frontmost is true end tell set tryZoomedAttribute to true set tryMenuScripting to false set tryButtonScripting to false set allMethodsFailed to false -- Special cases. For Applications whose behavior we know responds to one or the other -- method, force that method here. if (frontAppName is equal to "iTunes") then set tryZoomedAttribute to false set tryMenuScripting to true end if if (tryZoomedAttribute is equal to true) then tell application frontAppName try set zoomed of window 1 to not (zoomed of window 1) on error set tryMenuScripting to true end try end tell end if -- Make sure the user has UI scripting enabled before we go on... if ((tryMenuScripting is equal to true) or (tryButtonScripting is equal to true)) then tell application "System Events" if UI elements enabled is false then tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" display dialog "UI element scripting is not enabled. Check 'Enable access for assistive devices'" end tell end if end tell end if if (tryMenuScripting is equal to true) then tell application "System Events" tell process frontAppName try click menu item "Zoom" of menu of menu bar item "Window" of menu bar 1 on error set tryButtonScripting to true end try end tell end tell end if if (tryButtonScripting is equal to true) then -- UI Scripting method: tell application "System Events" try tell process frontAppName click button 2 of window 1 end tell on error set allMethodsFailed to true end try end tell end if if (allMethodsFailed is equal to true) then display dialog "I'm sorry, I couldn't figure out how to zoom this window." end if |
| Artikel empfehlen | » | » | » |
No comments yet.
Leave a comment
No trackbacks yet.