Created
August 5, 2012 14:58
Launch all Dock apps with exclusions based on modifier keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Launch All in Dock.applescript | |
-- Brett Terpstra 2012 | |
-- | |
-- Modified version of an AppleScript to launch all | |
-- persistent (Keep in Dock) apps[^1]. Allows you to exclude | |
-- apps based on modifier keys held when it runs. | |
-- | |
-- Uses the `keys` utility found on the Apple Mailing Lists[^2]. | |
set optDoNotOpen to {"com.adiumx.adiumx", "com.skype.skype"} | |
set shiftDoNotOpen to {"com.apple.mail"} | |
delay 2 | |
set optKeyDown to (do shell script "/usr/local/bin/keys option") | |
set shiftKeyDown to (do shell script "/usr/local/bin/keys shift") | |
set _exclude to "" | |
if optKeyDown = "1" then | |
repeat with _app in optDoNotOpen | |
set _exclude to _exclude & "|grep -v " & _app | |
end repeat | |
end if | |
if shiftKeyDown = "1" then | |
repeat with _app in shiftDoNotOpen | |
set _exclude to _exclude & "|grep -v " & _app | |
end repeat | |
end if | |
return do shell script "for app in $(defaults read com.apple.dock persistent-apps|grep bundle-identifier" & _exclude & "| awk '{print $3}'| tr -d '\";'); do open -g -b $app; done" | |
-- [^1]: <http://brettterpstra.com/launching-your-entire-dock-at-once/> | |
-- | |
-- [^2]: <http://lists.apple.com/archives/applescript-users/2009/Sep/msg00374.html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment