Created
March 3, 2011 17:12
-
-
Save halbtuerke/853121 to your computer and use it in GitHub Desktop.
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
-- starts listed applications | |
set theAppList to {"GrowlHelperApp", "LaunchBar", "Default Folder X Helper", "MercuryMoverAgent", "HardwareGrowler", "HazelHelper", "BetterTouchTool", "NetworkLocation", "LazyMouseBG", "SteerMouse Manager", "TextExpander", "Optimal Layout", "Dropbox"} as list | |
set theDelay to 15 | |
set appCount to count of theAppList | |
repeat with currentApp in theAppList | |
tell application "System Events" | |
set isGrowlRunning to ¬ | |
(count of (every process whose name is "GrowlHelperApp")) > 0 | |
end tell | |
if isGrowlRunning then | |
tell application "GrowlHelperApp" | |
set the allNotificationsList to ¬ | |
{"Success Notification", "Failure Notification"} | |
set the enabledNotificationsList to ¬ | |
{"Success Notification"} | |
(register as application ¬ | |
"Login Launcher" all notifications allNotificationsList ¬ | |
default notifications enabledNotificationsList ¬ | |
) notify with name ¬ | |
"Success Notification" title ¬ | |
"Login Launcher" description ¬ | |
"Launching " & currentApp & " #" & appCount application name "Login Launcher" | |
notify with name ¬ | |
"Failure Notification" title ¬ | |
"Launch Failure" description ¬ | |
"Alas — you won't see me until you enable me..." application name "Login Launcher" | |
end tell | |
end if | |
tell application currentApp to launch | |
delay theDelay | |
tell application "Finder" to set visible of process currentApp to false | |
set appCount to appCount - 1 | |
end repeat | |
-- removes listed applications from login items | |
set removeAppList to {"TextExpander", "SteerMouse Manager", "LazyMouseBG", "HazelHelper", "MercuryMoverAgent"} | |
tell application "System Events" | |
--Find out what login items we have | |
get the name of every login item | |
--see if the item we want exists. If so then delete it | |
repeat with removeApp in removeAppList | |
-- display dialog "removing " & removeApp | |
if login item removeApp exists then | |
delete login item removeApp | |
end if | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment