Skip to content

Instantly share code, notes, and snippets.

@danielpunkass
Created May 23, 2012 03:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpunkass/2773193 to your computer and use it in GitHub Desktop.
Save danielpunkass/2773193 to your computer and use it in GitHub Desktop.
For Brent...
tell application "System Events"
set frontProcess to first process whose frontmost is true
-- When it's down to just Finder and the front process, we have to switch
-- to the Finder first to get the front process to hide itself. Furthermore,
-- the Finder will not be listed as among the visible processes unless it
-- has open windows, so treat a condition of 2 *or fewer* visible apps as
-- meaning the Finder should be activated before hiding the front process.
if (count of (processes whose visible is true)) is less than or equal to 2 then
tell application "Finder" to activate
end if
set visible of frontProcess to false
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment