r/applescript • u/bjossymandias • Dec 19 '22
Script to reverse the scroll direction.
Hi,
Didn't know where to post this. I've been having trouble creating an applescript to reverse the scroll direction on Ventura. I finally figured it out and am posting so others could use it.
The old script before Ventura was:
try
tell application "System Settings"
reveal 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"
tell application "System Settings" to quit
end tell
end tell
end tryThe working version for Ventura is this:
# This should work with Ventura 13.1 (2022-12-19)
do shell script "open x-apple.systempreferences:com.apple.Trackpad-Settings.extension" -- Opens the trackpad settings window
delay 0.7 -- The delay is there to make sure the System Events can click buttons.
tell application "System Events"
tell process "System Settings"
click radio button 2 of tab group 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
click checkbox "Natural scrolling" of group 1 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
tell application "System Settings" to quit
end tell
end tellIf anybody finds a better way, please let me know!
10
Upvotes
View all comments
Show parent comment
1
u/bjossymandias Dec 22 '22 edited Dec 23 '22
Thanks for this!
Huh, I would love to know why. I’m using Ventura 13.1 on the M1 Pro from 2021.
There must be some way to use the terminal for this but I use an Alfred workflow that runs the applescript in my OP. I have to try yours since I hate that split second where I can see my system settings.
I’m gonna join you in trying to find a way to make this usable in the command line!
EDIT: I found out why it wasn't working. Somehow the thing didn't paste correctly on reddit, there should be a space between "open" and "x-apple...". I fixed it in the OP.