Created
April 20, 2011 18:11
-
-
Save HotFusionMan/932177 to your computer and use it in GitHub Desktop.
Requires that you've set up a ~/com.apple.loginitems.plist file defining what apps you want to launch. It would be nice to automate converting from using the system's copy of this file to this custom-located one.
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'rexml/document' | |
def set_up_Growl | |
if `ps -ax | grep GrowlHelperApp\.app | grep -v grep` == '' then | |
system( 'open /Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app' ) | |
end | |
end | |
set_up_Growl | |
loginitems_plist_xml = `plutil -convert xml1 -o - -- ~/com.apple.loginitems.plist` | |
REXML::Document.new( loginitems_plist_xml ).each_element( '/plist/dict/dict/array/dict/dict/dict' ) { |login_item_dict| | |
index_of_Path_key = i = 0 ; elements = [] | |
login_item_dict.each_element { |e| | |
elements << e | |
if e.text == 'Path' then | |
index_of_Path_key = i | |
end | |
i += 1 | |
} | |
login_item = elements[index_of_Path_key + 1].text | |
system( "open '#{login_item}'" ) | |
sleep( 1 ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment