Toggling MagicMouse touch-scroll functionality

Hello everyone,

I’m new on the boards since today, as I wanted to tackle a long-time annoying problem I’ve had with the Apple MagicMouse. In some applications like Adobe Illustrator and Rhinoceros, the touch-based scrolling of the MagicMouse sometimes accidentally scrolls and zooms in all kinds of directions. So I wanted to make a quick way to turn off the MagicMouse scrolling functionality, and to turn it back on again when switching to a browser for example.

It’s my first ever Apple script, so I’m sure it’s in need of some improvements. If you have any ideas or comments, please let me know and help to improve it!


tell application "System Preferences"
	activate
	reveal anchor "Mouse" of pane id ("com.apple.preference.universalaccess")
end tell

tell application "System Events"
	tell process "System Preferences"
		tell window "Universal Access"
			click button 1 of tab group 1
			click checkbox "Scrolling" of sheet 1
			set checkboxstate to value of checkbox "Scrolling" of sheet 1
			click button "Done" of sheet 1
		end tell
	end tell
end tell

tell application "System Preferences"
	quit
end tell

if checkboxstate is 1 then
	display dialog "Scrolling is enabled." giving up after (1) buttons {"Ok"}
else
	display dialog "Scrolling is disabled." giving up after (1) buttons {"Ok"}
end if

I’m using it in combination with FastScripts (http://www.red-sweater.com/fastscripts/) to bind the script to a keyboard shortcut, so I can turn it on and off whenever I like.

Hope it’s useful to someone else as well.

Cheers,
Harry

Operating System: Mac OS X (10.7)