mnml.blog

Applescript to Change Scroll Direction

I am currently using my MacBook Pro as my main computer. I have a new dock that is permanently connected to my monitors and peripherals in the home office. I don’t use the same scroll direction for mouse and trackpad so I need to change the scroll direction in System Preferences each time I dock or undock the Mac. There are several utilities that do this but I prefer to use Applescript and FastScripts. Here is the script I’m using.

try
	tell application "System Preferences"
		(run)
		set current pane to pane "com.apple.preference.trackpad"
	end tell
	delay 0.5
	tell application "System Events"
		tell process "System Preferences"
			click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
			click checkbox 1 of tab group 1 of window "Trackpad"
			tell application "System Preferences" to quit
		end tell
	end tell
end try

You might also create an Automator application with this script and call it using Spotlight or your favorite app launcher.