Switch Between Nvidia Chipsets on new Alu-book pro.

I was frustrated to find that I had quite a task to get in and out of the Nvidia 9400M and the 9600M GT chips ( Better performance or Better Battery Life ), on the new macbook pro late 2008-2009 15 and 17, so I created this little applescript to switch for me.

It is clumpsy as I am not the applescript guru but it works fine…

Suggestions welcome:

Symonty.



tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.energysaver"
end tell

tell application "System Events" to tell process "System Preferences"
	if (value of radio button "Better battery life" of radio group 1 of window 1 is equal to 1) then
		set GPUto to "Higher Performance"
	else
		set GPUto to "Better battery life"
	end if
end tell

tell application "performance_switch"
	activate
end tell

set question to display dialog "I will set to '" & GPUto & "' and Log out" buttons {"OK", "Cancel"} default button 2
set answer to button returned of question

tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.energysaver"
end tell

tell application "System Events" to tell process "System Preferences"
	
	if answer is equal to "OK" then
		if GPUto is equal to "Higher Performance" then
			click radio button "Higher performance" of radio group 1 of window 1
		else
			click radio button "Better battery life" of radio group 1 of window 1
		end if
		delay 0.5
		keystroke return
	end if
end tell

delay 0.5

tell application "System Preferences"
	activate
	quit
end tell