View Single Post
Perhaps I can save you the trouble:

Code:
-- button labels for dialog
property pWork : "Work"
property pReview : "Review"
property pReset : "Reset"
-- strings for shell commands to set OmniFocus parameters
property pDefaultsWriteCommand : "defaults write"
property pDefaultsDeleteCommand : "defaults delete"
property pOmniFocusDomain : "com.omnigroup.OmniFocus "
-- badge names
property pInboxBadge : "InboxBadge"
property pAvailableBadge : "AvailableBadge"
property pDueSoonBadge : "DueSoonBadge"
property pOverdueBadge : "OverdueBadge"
-- badge options
property pCount : "count"
property pDot : "dot"
property pNone : "none"

-- Set up preferred badge settings here.  Badge options are {pCount, pDot, pNone}.
property pReviewAvailableBadge : pCount
property pReviewDueSoonBadge : pCount
property pReviewOverdueBadge : pCount
property pReviewInboxBadge : pCount

property pWorkAvailableBadge : pDot
property pWorkDueSoonBadge : pDot
property pWorkOverdueBadge : pDot
property pWorkInboxBadge : pDot

on run
	set recReply to display dialog "Set badges for Work or Review?" buttons {pWork, pReview, pReset}
	set btnChosen to button returned of recReply
	
	tell application "System Events"
		if (exists process "OmniFocus") then
			tell application "OmniFocus" to quit
		end if
		repeat until not (exists process "OmniFocus")
			delay 0.2 -- give it some time to do so 
		end repeat
	end tell
	
	if btnChosen is pWork then
		SetDefault(pAvailableBadge, pWorkAvailableBadge)
		SetDefault(pDueSoonBadge, pWorkDueSoonBadge)
		SetDefault(pOverdueBadge, pWorkOverdueBadge)
		SetDefault(pInboxBadge, pWorkInboxBadge)
	else if btnChosen is pReview then
		SetDefault(pAvailableBadge, pReviewAvailableBadge)
		SetDefault(pDueSoonBadge, pReviewDueSoonBadge)
		SetDefault(pOverdueBadge, pReviewOverdueBadge)
		SetDefault(pInboxBadge, pReviewInboxBadge)
	else if btnChosen is pReset then
		ResetDefault(pAvailableBadge)
		ResetDefault(pDueSoonBadge)
		ResetDefault(pOverdueBadge)
		ResetDefault(pInboxBadge)
	end if
	
	activate application "OmniFocus" -- restart OmniFocus with new settings
end run

on SetDefault(sBadge, pSetting)
	do shell script pDefaultsWriteCommand & space & pOmniFocusDomain & space & sBadge & space & pSetting
end SetDefault

on ResetDefault(sBadge)
	try
		do shell script pDefaultsDeleteCommand & spcae & pOmniFocusDomain & space & sBadge
	on error
		-- probably didn't have a setting to delete
	end try
end ResetDefault
This script offers 3 choices (Work, Review, Reset). Work and Review set the badges as configured near the top of the script (default being colored dot for work, number for review), Reset returns them to the factory settings. OmniFocus then quits and reopens with the new settings.