© 2006 by Daniel Jalkut, Inspired by:- application "System Events" set frontAppName to name of first application process whose frontmost is trueend tellset tryZoomedAttribute to trueset tryMenuScripting to falseset tryButtonScripting to falseset allMethodsFailed to false- Special cases. A script to automatically zoom the frontmost window. Kind of overkill, but it is handy to have something that "almost always works." In particular, iTunes doesn't seem to respond well to the direct attribute setting, so I override it. I also include a section at the top to add special cases for particular apps. This should make a pretty compatible script which zooms in the quickest way possible (direct attribute) when possible, and otherwise resorts to UI scripting methods. Zoom by clicking the zoom button on the window. Zoom by selecting a Zoom menu item from the Window menu.3. Zoom by directly changing the "zoomed" attribute on the window.2. This script will try 3 methods of zooming, in the following order:ġ. By the way - I noticed that using the keyboard shortcut "opt-Z" messes up some apps - iTunes in particular, since it behaves differently when the option key is held down while zooming! OK - I've taken the opposite tack of my previous script. I picked that key combination because it's easy to press - I remember it by thinking of the Z as standing for Zoom. I saved my script as "Click Green Maximize Button of Frontmost Window.scpt." I then used Quicksilver's triggers feature to assign the keyboard shortcut Control-Option-Z to run the script. You can paste the above script into Script Editor and save it in your ~/Library/Scripts/ folder (or anywhere else you'd like). Check 'Enable access for assistive devices'" end tell end ifend tell end tell else tell application "System Preferences" activate set current pane to pane "" display dialog "UI element scripting is not enabled. Tell application "System Events" if UI elements enabled then set FrontApplication to (get name of every process whose frontmost is true) as string tell process FrontApplication click button 2 of window 1 -button 2 is the green "zoom" button for all applications -window 1 is always the frontmost window.
0 Comments
Leave a Reply. |