Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'applescripting it' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
applescripting it
Authored by: tedw on Nov 11, '10 11:22:12AM
This applescript should add the UUIDs automatically, and should work for future updates as well. Just run it at need - it will only update the growlMail info.plist file if the UUIDs are missing. Notes:
  • Run this from the AppleScript Editor (in Application/Utilities)
  • I've tested this pretty thoroughly, but haven't actually run it live since I haven't done the update yet.
  • If you modify the script Be Careful! Do not use a 'set' command with the mailPlist or frameworkPlist object variables. System Events updates plist files in real time, so executing the line (say) 'set mailPlist to {}' might zero-out the Mail.app info.plist file. And no, you don't want to do that.
tell application "System Events"
	-- recover uuids from Mail and framework info.plists
	set mailPlist to property list file "/Applications/Mail.app/Contents/Info.plist"
	set frameworkPlist to property list file "/System/Library/Frameworks/Message.framework/Resources/Info.plist"
	tell mailPlist
		set mailCompatUUID to the value of property list item "PluginCompatibilityUUID"
	end tell
	tell frameworkPlist
		set frameworkCompatUUID to the value of property list item "PluginCompatibilityUUID"
	end tell
	
	-- add to growlMail info,plist
	set growlmailPluginPaths to {"~/Library/Mail/Bundles/", "/Library/Mail/Bundles/", 
		"~/Library/Mail/Bundles (Disabled)/", "/Library/Mail/Bundles (Disabled)/"}
	repeat with thisPath in growlmailPluginPaths
		-- run through possible locations looking for the growlMail bundle
		if exists disk item (thisPath & "GrowlMail.mailbundle") then
			set growlmailPlist to 
				property list file (thisPath & "GrowlMail.mailbundle/Contents/Info.plist")
			tell growlmailPlist
				tell property list item "SupportedPluginCompatibilityUUIDs"
					-- check to see if uids exist, and add them if they don't
					set uuidList to its value
					if uuidList does not contain mailCompatUUID then
						make new property list item at end of property list items 
							with properties {value:mailCompatUUID}
					end if
					if uuidList does not contain frameworkCompatUUID then
						make new property list item at end of property list items 
							with properties {value:frameworkCompatUUID}
					end if
				end tell
			end tell
			
			-- try to move bundle into bundles folder if it's in disabled folder
			if thisPath contains "(Disabled)" then
				set enabledPath to path of disk item (text 1 thru -13 of thisPath)
				try
					move disk item (thisPath & "GrowlMail.mailbundle") to alias enabledPath
				on error
					--something (possibly permissions) went wrong
					say "Move failed"
					set theFolderPath to path of disk item thisPath
					tell application "Finder"
						activate
						open folder theFolderPath
					end tell
				end try
			end if
			exit repeat
		end if
	end repeat
end tell


[ Reply to This | # ]
applescripting it
Authored by: Quatch on Nov 11, '10 12:42:44PM

Ran it, restarted mail. Did not get a complaint. Tested an email, and it works.

Many thanks.



[ Reply to This | # ]
applescripting it
Authored by: everkleer80 on Nov 12, '10 04:34:22PM

Thanks for the script- Worked great! Only problem I had was that for some reasone my growlmail bundle got moved to a folder called "Bundles (Disabled 1)". I deleted the empty "Bundles (Disabled)" folder though and renamed the Disabled 1 folder and everything worked.



[ Reply to This | # ]
applescripting it
Authored by: khoriati on Nov 16, '10 04:10:37AM

Same for me.

One *(Disabled #) folder for each installation try.

Moved the last and deleted others. Keys applied and ...everything is ok now.

Thanks a lot!



[ Reply to This | # ]
applescripting it
Authored by: tedw on Nov 16, '10 08:20:54AM

Interesting. Do you have the bundle installed in you home directory library or the computer library? I was worried about permissions issues when trying to move folders in the computer library (that's the reason behind the 'try' block). I'm wondering if that's what the script is running into.



[ Reply to This | # ]
applescripting it
Authored by: cparnot on Mar 15, '11 09:21:00AM

The script works great for Mail 4.4.1 on the new MBP as well.

Thanks for the script, it's forever on my hard-drive now!

---
charles



[ Reply to This | # ]