Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

n8236

macrumors 65816
Original poster
Mar 1, 2006
1,065
32
Does anyone know how to create an automation to uncheck then recheck the "tap to right click" option under Preference ~> Trackpad option? The 2ndary click works great if I don't restart OSx much, but I do it often enough that it gets annoying to manually re-activiate that option since it doesn't load up on restarts.

Thanks :)
 
It's possible with GUI scripting in AppleScript. Don't have time right now, but I'll try to remember to put a script together and post it later today.
 
Oh, I didn't realize you were asking about a MacBook/MacBook Pro only option. I'd need one of those to figure the script out correctly. However, I'll post a starting point. This script sets the "Ignore accidental trackpad input" option in the Trackpad tab of Keyboard & Mouse Preferences. Hopefully someone else will come along who has a MB or MBP and modify it to do what you want. The modification is very small, you just have to use UI Element Inspector to figure out which checkbox is "tap to right click" and change the AppleScript to check that instead. It may be as simple as replacing "Ignore accidental trackpad input" in the script with the (exact) name of the checkbox you're concerned with. To use this script, open Script Editor and paste it in, then save it as an application where ever you'd like. To make it work, you'll have to check "Enable GUI Scripting" in AppleScript Utility in your Utilities folder. Hope this helps.

Code:
--Open and activate System Preferences
tell application "System Preferences" to activate

--Attempt to change settings using System Events
tell application "System Events"
	tell process "System Preferences"
		try
			--Open the "Keyboard & Mouse" pane
			click menu item "Keyboard & Mouse" of menu "View" of menu bar 1
			
			--Now set the option. The delays prevent actions being sent before previous ones have been completed
			delay 2
			tell tab group of window "Keyboard & Mouse"
				click radio button "Trackpad"
				delay 2
			end tell
			if (the value of checkbox "Ignore accidental trackpad input" of group 1 of tab group 1 of window "Keyboard & Mouse") is 0 then
				click checkbox "Ignore accidental trackpad input" of group 1 of tab group 1 of window "Keyboard & Mouse"
			end if
			
		on error theError
			--An error occured
			display dialog ("Sorry, an error occured while altering Keyboard and Mouse settings:" & return & theError) buttons "OK" default button "OK"
		end try
	end tell
end tell
delay 1
tell application "System Preferences" to quit
 
Awesome work man, i'll give this a shot! I guess i wouldn't have that problem once I start using Parallells instead of Bootcamp :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.