I'm not a fan of Microsoft Outlook. Unfortunately, I'm often required to use it. Most of the time, a combination of Apple's Mail.app and iCal is good enough to get the job done. However, there are occasions that you need to use Outlook. In particular, Outlook is the only way to set a server-side rule on an Exchange server.
So, every once in a while I need to fire up Outlook to create a new rule. Here's the part that really gets on my nerves: Every time you launch Outlook on OS X, it launches
Microsoft Office Reminders which shows a popup window with reminders for all of your appointments. Additionally, it launches
Microsoft Database Daemon and adds it to your Login Items.
Rather than having to quit out of
Microsoft Office Reminders and go into System Preferences > Users & Groups > Login Items every time I run Outlook, I wrote a little script to do it for me.
Since I usually have a Terminal window open, I simply run
kill-mso-remnants after I quit Outlook and we're back to where we started.
#!/usr/bin/env bash # Kill the two processes. for PROC in "Microsoft Database Daemon" "Microsoft Office Reminders"; do echo "Killing $PROC" killall "$PROC" done # This plist file contains your Login Items. PLIST_FILE="$HOME/Library/Preferences/loginwindow.plist" # PlistBuddy lets you edit plist files from the command line. PLIST_BUDDY="/usr/libexec/PlistBuddy" # The app that gets added to your Login Items. APP_NAME="/Applications/Microsoft Office 2011/Office/Microsoft Database Daemon.app" # This loop searches the plist file for the offending application and, if it's # found, removes it. INDEX=0 while : do # Print the application path for this item in the list and capture the # output. OUTPUT=$($PLIST_BUDDY $PLIST_FILE -c "Print :AutoLaunchedApplicationDictionary:$INDEX:Path" 2>&1) # If the output is the name of the offending application... if [ "$OUTPUT" = "$APP_NAME" ]; then # Delete the containing element from the plist file. $PLIST_BUDDY $PLIST_FILE -c "Delete :AutoLaunchedApplicationDictionary:$INDEX" echo "Entry for $APP_NAME deleted from $PLIST_FILE" break # If the output matches "Does Not Exist", we have finished searching # without finding a match. elif [[ "$OUTPUT" =~ "Does Not Exist" ]]; then echo "Could not find Plist entry for $APP_NAME" break fi INDEX=$((INDEX + 1)) done