I am using a MacBook Air running Sierra.
I like to use different mouse settings with my touchpad, and my USB mouse. To facilitate this, every time I plug my mouse in, I have to go to System Preferences
and change the mouse settings (reverse scroll direction and adjust sensitivity). Is there any way by which I can automate this change (maybe using automator) in settings to occur automatically every time I plug in the USB mouse?
Best Answer
Under macOS Sierra, if you have only a normal USB mouse, not one that comes with it's own software and is multi-function with additional buttons, etc., then in System Preferences > Mouse, you have the following settings that can be changed:
And two additional settings under Mouse that will not be addressed, for two reasons, the Primary mouse button: radio buttons, if other then the default of Left, is in all likelihood already set and wouldn't necessarily change because one wants to change the Scroll direction: natural checkbox, and since the OP stated USB mouse, I'll assume is not using Bluetooth and can ignore the Setup Bluetooth Mouse... button.
This answer is going to use AppleScript to get the before and after settings for the value of the aforementioned listed sliders to be used in the AppleScript code that follows after this code.
Open Script Editor and create a new document, then add the following code:
There will be two difference states of the Scroll direction: natural checkbox in System Preferences > Mouse, checked and unchecked and the change in slider settings between the two states.
The code above will be run once to get the current value settings of the sliders. Then make the setting changes that you want to the sliders for the opposite state of what it was when you gathered the values of the first settings for the first state. Then run the code again to get the differential settings.
You will then plug in the values, gathered above, in the code below. You can comment out or remove any slider that's not going to be changed by the code below.
The comments in the code below should be adequate, however, don't hesitate to ask it you need anything explained.
I saved the following AppleScript code in Script Editor as an application named Toggle Mouse Settings in the Applications folder.
When run, it toggles the state of the Scroll direction: natural checkbox between checked and unchecked along with the slider settings under each state.
AppleScript code for the Toggle Mouse Settings app:
Note: Before running the Toggle Mouse Settings app, you'll need to add it to: System Preferences > Security & Privacy > Privacy > Accessibility
There is an app called EventScripts that could be used to trigger when a USB device is plugged in and or removed. I have not used it before, just aware it exists.
There is also an app called Scroll Reverser. I have not used it before, just aware it exists.