OS X Lion Inverted Scrolling Automation Shortcut

11

As everyone will know (who has Mac OS X Lion), by default, scrolling is inverted to make it a bit like the iPhone.

Problem: There is no way to have "normal scrolling" for a USB mouse, and "natural/inverted" scrolling for the trackpad. The setting (even though it is listed in both the mouse and trackpad settings) applies to both.

Question: Could someone, who is experienced with Automator or AppleScipting, please give me a few tips on how to make a shortcut that can toggle the inverted setting? I need this as when I'm at home, I have my Mac Book Air plugged to my Keyboard, Mouse and Monitor, and I'd like a quick way to change this setting

jtnire

Posted 2011-08-09T17:58:06.663

Reputation: 247

Just curious, is opening Preferences not fast enough? – None – 2011-08-09T17:59:47.723

I'm constantly docking and undocking my mac book, so a nice shortcut to change this would be nice. – None – 2011-08-09T18:01:41.437

3Why are people voting down this post? Is there something I have done wrong? – None – 2011-08-09T18:06:56.580

Answers

3

This ought to do it:

tell application "System Preferences" to set the current pane to "com.apple.preference.mouse"
tell application "System Events"
    tell process "System Preferences"
        click radio button "Point & Click" of tab group 1 of window "Mouse"
        click the first checkbox
    end tell
end tell

Final Working Solution:

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 & Zoom" of tab group 1 of window "Trackpad"
        click checkbox 1 of tab group 1 of window "Trackpad"
    end tell
end tell

tell application "System Preferences"
    quit
end tell

fireshadow52

Posted 2011-08-09T17:58:06.663

Reputation: 185

This is not working for me for Mac OS 10.9.5 – Asad Iqbal – 2014-12-26T22:42:43.753

This is what I have so far: http://pastebin.com/L0Tf7NSh It says it can't find checkbox 1

– None – 2011-08-09T18:27:24.717

...checkbox of group 1 try that. – None – 2011-08-09T18:32:48.923

"System Events got an error: Can’t get group 1 of process "System Preferences". Invalid index." – None – 2011-08-09T18:34:58.237

Ok, this works: http://pastebin.com/JGUvA8U9 Any ideas on how I get the window to close?

– jtnire – 2011-08-09T18:42:33.237

Ok: this is my final solution: http://pastebin.com/67PH15Ee

– jtnire – 2011-08-09T18:49:28.017

In case anyone else would try this out, the value isn't updated immediately when modifying .GlobalPreferences directly. k=com.apple.swipescrolldirection; r=\defaults read -g $k`; [[ $r == "1" ]] && b=false || b=true; echo $b; defaults write -g $k -bool $b` – Lri – 2011-08-10T13:06:24.983