Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Minimize all Finder windows at login via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Minimize all Finder windows at login via AppleScript
Authored by: zejoao2000 on Jan 02, '10 06:53:20AM
This is my first 2 cents in this forum... Let's see how it comes out.

Taking the core coding option of the first solution by meanbone (using system events to force Minimize All), I came up with this solution to the problem.

-- BEGIN SCRIPT
tell application "Finder"
   activate
   if the (count of windows) is not 0 then
      select Finder window 1
      tell application "System Events"
         tell process "Finder"
            keystroke "m" using {command down, option down}
         end tell
      end tell
   end if
end tell
-- END OF SCRIPT

The if clause tests to see if there are any Finder windows opened. If so, the first one is chosen and "System Events" does the work. If not, nothing happens.

Although there are simpler solutions stated in this thread, I write this one because of the different coding approach to the window selection.
One other advantage of this script is to minimize all the windows in a single step.

Hope it helps someone.
Cheers.
Edited on Jan 02, '10 07:19:37AM by zejoao2000


[ Reply to This | # ]