Hi
I am new to Mac (Lion 10.7.2), and am playing around with AppleScript. I have the following script that minimizes all visible windows:
Code:
tell application "System Events"
--Get all the available applications that can be visible
repeat with appProc in (every application process whose visible is true)
--From the available applications above, click on the minimize
-- button of every window that has a minimize button
click (first button of every window of appProc whose role description is "minimize button")
end repeat
end tell
Here are my problems and quesions…
The script does work, except it is kind of slow, meaning instead of instantly minimizing all the windows, you watch each one get minimized one by one. I tried saving it as an application from AppleScript Editor, but then it is really really slow (takes about 5 to 10 seconds before it even starts doing anything).
QUESTION #1
Can this script be imported into Xcode and be converted to an app that will run much faster?
QUESTION #2
I was looking for other ways to do this instead of “click button”, and I found references to the miniaturized property of the window, but this property and the miniaturizable property both do not appear to exist when I view the properties of applications and windows. I have searched google for hours about this, and cannot figure out why it is not availble.
Questions #3 and #4 I was about to ask, but found answers a few minutes ago, and thought I would post because they are related:
ANSWERED QUESTION #3
How can I create an alias on the desktop (to the .scpt file), that when clicked, will run the script instead of opening it up in AppleScript Editor? I do not want to the Script Menu in the menu bar to run the script.
ANSWERED QUESTION #4:
Can AppleScript be iimported into Automator and converted to an application?
ANSWER for Question #3 and #4:
Start Automator, choose new Application and then drag the Run Applescript Action over to the right hand side and then copy and paste your applescript into it and save it. You now have an application that runs just as fast as the original applescript, and you can also create an alias on your desktop to it.
Thanks