May 08, 2011

Applescript to remove and add login items

The login items for your user account in system preference is where you set applications to launch anytime you login to your computer, including restarts. My recent switch back to Quicksilver prompted the compilation of this script, which shows code that will remove other launchers from startup status and ensure that QS is set.
-- Script to remove other launchers from login items and add Quicksilver

tell application "Finder" to set QSpath to POSIX path of (application file id "com.blacktree.Quicksilver" as string)

tell application "System Events"
if login item "LaunchBar" exists then delete login item "LaunchBar"
if login item "Alfred" exists then delete login item "Alfred"
if (login item "Quicksilver" exists) is false then make new login item at end of login items with properties {path:QSpath, hidden:true, kind:application, name:"Quicksilver"}
end tell

No comments:

Post a Comment