I have the AppleScript to toggle the "Ignore built-in trackpad when mouse is present" preference on OSX Mavericks working in the code box below, but I can't keep the "System Preferences" hidden and get the annoying flash as it activates the application window briefly to turn the trackpad on or off. Any thoughts on how I might hide this process? More details below...
Some background: I use my Macbook Pro with Mavericks both with and without an external mouse (a Logitech trackball actually). Both because I hate stray trackpad input as I type and because using only the trackpad can cause me wrist pain after a while, I like to set the "System Preferences / Accessibility / Mouse & Trackpad / Ignore built-in trackpad when mouse or wireless trackpad is present" checkbox to true when using the USB trackball.
But because I also like to leave the tiny USB dongle in there, when I don't bother to bring the trackball along I can't easily use the built-in trackpad. So I have been writing an AppleScript to tell System Preferences toggle the Ignore Trackpad setting. That way I can just use command-space to start spotlight and run the ToggleTrackpad script from the keyboard.
I am open to other solutions to this problem. I looked into finding a defaults write command for this by seeing if any plist files changed in the ~/Library/Preferences directory, but nothing seemed to change when I ran a diff on their old versions, so I never could figure out where in Mavericks this setting was being stored.
Code:
-- open trackpad preferences
tell application "System Preferences"
activate
reveal (pane id "com.apple.preference.universalaccess")
end tell
tell application "System Events"
tell process "System Preferences"
tell window "Accessibility"
tell scroll area 1
click UI element "Mouse & Trackpad" of row 10 of table 1
end tell
-- click trackpad enable/disable when connected
tell checkbox 2
click
end tell
click button "Show All" of group 1 of group 2 of toolbar 1
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
Some background: I use my Macbook Pro with Mavericks both with and without an external mouse (a Logitech trackball actually). Both because I hate stray trackpad input as I type and because using only the trackpad can cause me wrist pain after a while, I like to set the "System Preferences / Accessibility / Mouse & Trackpad / Ignore built-in trackpad when mouse or wireless trackpad is present" checkbox to true when using the USB trackball.
But because I also like to leave the tiny USB dongle in there, when I don't bother to bring the trackball along I can't easily use the built-in trackpad. So I have been writing an AppleScript to tell System Preferences toggle the Ignore Trackpad setting. That way I can just use command-space to start spotlight and run the ToggleTrackpad script from the keyboard.
I am open to other solutions to this problem. I looked into finding a defaults write command for this by seeing if any plist files changed in the ~/Library/Preferences directory, but nothing seemed to change when I ran a diff on their old versions, so I never could figure out where in Mavericks this setting was being stored.
Last edited: