Twitter Updates

Wednesday, 17 September 2008

Mac OS X Full Screen Button

While I have not quite got this one cracked yet I found a script that came close.
The script is the equivalent of pressing the top left + window button. which toggles the window between its optimised size and the last user defined size.

I also have quick silver installed and added ctrl-m to trigger the script.
I keep the script in ~/Scripts
maximise app.scpt

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.
end tell
tell application "System Preferences"
set current pane to pane ""
display dialog "UI element scripting is not enabled. Check 'Enable access for assistive devices'"
end tell
end if
end tell

I did not write the script and unfortunately cant remember where I got it to credit the writer. If you know the original source let me know.
if it does not run you probably need to set the execurtable permission from the terminal
cd ~/Scripts
chmod u+rwx maximise\ app.scpt

No comments: