Changing trackpad scroll direction with AppleScript in Yosemite I prefer "natural" scroll direction when using my MBAir trackpad, but "unnatural" when using the mouse. I frequently switch back and forth depending on where I'm working, so I've been using a bit of AppleScript to switch the setting. This script stopped working when I upgraded to Mac OS Yosemite. It still opens the Scroll &amp; Zoom pane of the Trackpad preferences, but it doesn't click the checkbox. I've tried a few things but I can't get it to work.. I'm not an Apple Developer, so I don't have any debugging tools. Any tips? 

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

    tell application "System Events"
        tell process "System Preferences"
            click radio button "Scroll &amp; Zoom" of tab group 1 of window "Trackpad"
            click checkbox 1 of tab group 1 of window "Trackpad"
        end tell
    end tell
end try
First, make sure Applescripts has permission to modify apps. 
This can be done by opening System Preferences | Security &amp; Privacy | Accessibility and checking Script Editor. This is a one time process and you shouldn't have to check it again.



I ran this same snippet @Bowen provided in his question on Mojave and noticed what he described. I fixed it by adding the delay mentioned by @Bowen in his answer. The box would either check or uncheck now that we have added a small delay.

Here is that example I ran directly from Script Editor:

try
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.trackpad"
end tell
delay 2
tell application "System Events"
    tell process "System Preferences"
        click radio button "Scroll &amp; 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


Also, In relation to this topic, I built something using ideas from this thread, since folks may want to automate it per their settings. The below script is "Automator ready", or can be exported as an application so you can run it at startup or however you want to execute it. You have to also allow access to the exported application as shown in the image above for "Scroll direction Clicker". This is specific to a Logitech mouse being found, but it can easily be modified to any other type of string/mouse type. It can also be used as a decent reference to build off of for scroll-direction. I for one got tired of flipping scroll-direction when going from mouse to trackpad, and that's how I found this thread.

Tailored to be exported as an Application from within Script Editor

try
    set logitech to "Logitech"
    try
        set scriptOutput to do shell script "system_profiler SPUSBDataType | grep -i logitech"
        if scriptOutput contains logitech then
            tell application "System Preferences"
                activate
                set current pane to pane "com.apple.preference.trackpad"
            end tell
            delay 2
            tell application "System Events"
                tell process "System Preferences"
                    set checkBoxOne to checkbox 1 of tab group 1 of window "Trackpad"
                    click radio button "Scroll &amp; Zoom" of tab group 1 of window "Trackpad"
                    tell checkBoxOne to if value is 1 then click
                    tell application "System Preferences" to quit
                end tell
            end tell
        end if
    on error errMsg
        log errMsg
        tell application "System Preferences"
            activate
            set current pane to pane "com.apple.preference.trackpad"
        end tell
        delay 2
        tell application "System Events"
            tell process "System Preferences"
                set checkBoxOne to checkbox 1 of tab group 1 of window "Trackpad"
                click radio button "Scroll &amp; Zoom" of tab group 1 of window "Trackpad"
                tell checkBoxOne to if value is 0 then click
                tell application "System Preferences" to quit
            end tell
        end tell
    end try
end try