What I did:
Using this link,
I created the following Applescript:
tell application "System Events" click (first button whose subrole is "AXZoomButton") of (first window whose subrole is "AXStandardWindow") of (first process whose frontmost is true) set frontApp to (name of first application process whose frontmost is true) as string tell application frontApp to activate end tell
This code allows me to "press" the green button at the top left corner of the window.
I run the code, using Alfred.
(Mountain Lion 10.8.4, Alfred 2.0.6)
Zooming works fine, but
- the zoomed window of the application loses focus.
- the three buttons, red, yellow and green, at the top-left corner of the window are all dimmed in grey after running the code.
- the menu bar still shows the application title, indicating that the application is still foremost.
(In this sense, the window is "half-activated"?)
If I click the window, those buttons go back to normal, showing red, yellow and green.
What I want:
I want to keep focus on the zoomed application window after running the code using Alfred.
Can anyone help me out, please?