How to automate changing the settings when you connect the mouse

applescriptautomationautomatormouse

I want to change option in System Preferences "Scroll direction: natural" every time I plugin mouse to my MacBook.

And switch back when mouse is disconnected.

This should happen automatically. How it's possible? Automator or applescript?

Best Answer

You can use Keyboard Maestro:

Repeat script with 'is disconnected'.
You may need to change the USB device name.
AppleScript from shell script: Toggle Natural scrolling from command line with reload