Is it possible to automatically switch between scrolling

mousescrollingtrackpad

So I have this logitech mouse that I use with my Macbook Pro.
I've been using it for a week now and I just CAN'T get used to the inverse scrolling direction on the mouse wheel.
So I decided to change it in my System Preferences, since I can't automatically change it in the Logitech mouse software.
But sometimes when I can't use my mouse I have to use my trackpad, and getting used to the "natural" scrolling is annoying.

So, is there a way to make my macbook automatically change the scrolling direction depending if I'm using my trackpad and my mouse?
Or does anyone know if theres a script that I can use, I'm ok with just using it on my Dock. I already have a script for clearing my clipboard

Best Answer

When I can, I prefer my own home-rolled solution to adding more third party software and if you want to toggle the state of the Scroll direction: natural checkbox, which is a global setting and found under both the Mouse and the Trackpad preference panes, under Point & Click, in System Preferences, you can use the following AppleScript code saved as an application and then place it in the Dock via drag and drop.

  • Note that because this is a global setting, it doesn't matter whether you check/uncheck from either the Mouse or the Trackpad preference panes and as such I've coded this to target the Mouse preference pane as it should have the checkbox even when a Trackpad isn't present.

I saved the following AppleScript code in Script Editor as an application named: Toggle Natural Scrolling


on run
    try
        tell application "System Preferences"
            set current pane to pane "com.apple.preference.mouse"
            activate
        end tell
        tell application "System Events" to tell process "System Preferences"
            tell radio button 1 of tab group 1 of window 1 to if value is 0 then click
            set cbValue to value of (click checkbox 1 of tab group 1 of window 1)
        end tell
        tell application "System Preferences" to quit
        tell me
            activate
            if cbValue is equal to 1 then
                -- display dialog "Natural scrolling is now active." buttons {"OK"} default button 1 with title "Toggle Natural Scrolling" giving up after 3
                display notification "Natural scrolling is now active."
            else
                -- display dialog "Natural scrolling is no longer active." buttons {"OK"} default button 1 with title "Toggle Natural Scrolling" giving up after 3
                display notification "Natural scrolling is no longer active."
            end if
        end tell
    on error eStr number eNum
        activate
        display dialog eStr & " number " & eNum buttons {"OK"} default button 1 with title "Toggle Natural Scrolling" with icon caution
    end try
end run

As presently coded the display dialog commands are commented out and are there because I originally wrote this under OS X 10.8.5, which doesn't support the display notification command, however I've also tested (some of the code) under macOS 10.12 and why the display notification command is being used. I've left both in the code since I do not know which version you're running and you can comment/uncomment accordingly.

Under OS X 10.9 and later, you will need to add the Toggle Natural Scrolling to Accessibility, under Privacy, under Security & Privacy preferences, in System Preferences. If you don’t, you’ll get the following error when running it:

Toggle Natural Scrolling is not allowed assistive access. number -1719