Turning Off Dashboard: Part 2

My script below below works if System Preferences was closed with the Expose (called Main) anchor of the Expose pane already revealed. However, it won’t reveal that pane. (ha, I just typoed pain)…any clue as to why?



-->shut off dashboard
	tell application "System Preferences"
		activate
		set the current pane to pane id "com.apple.preference.expose"
		--return name of every anchor of pane id "com.apple.preference.expose"
		reveal anchor "Main" of pane id "com.apple.preference.expose"
		
		tell application "System Events"
			tell process "System Preferences"
				tell group 2 of tab group 1 of window 1
					click pop up button 4
					click menu item "-" of menu 1 of pop up button 4
				end tell
			end tell
		end tell
	end tell



Browser: Firefox 3.0.4
Operating System: Mac OS X (10.5)

Hi,

the set current pane line is not needed.
But I couldn’t either reveal the Exposé tab. It might be a bug
Try this work around


tell application "System Preferences"
	activate
	reveal anchor "Main" of pane id "com.apple.preference.expose"
end tell
tell application "System Events" to tell process "System Preferences"
	click radio button "Exposé" of tab group 1 of window 1
end tell

Thanks Stefan, that worked nicely.