Script request

[SOLVED]

Hi,

I’m new here and I have 0 experience with scripting… I can look at a script and kinda understand what’s happening (kinda), but I don’t know how to code.
I’m looking for a script that does a simple thing:
Open System Preferences > go to the Trackpad section > on the Point & Click tab, select (or unselect if it’s selected) the “Tap to Click” option.

Can someone please provide that? I would be forever grateful ???

Here’s why I need it, in case someone is interested:
I’m a musician and one of my plugins doesn’t allow me to use the up/down arrows to navigate the preset browser, but they have previous/next buttons. I know I can click with the mouse or the trackpad’s button, but for some weird reason, the act of actually pressing a button seems more “tiring” that just tapping… (I know it’s weird, but… haha)

So I would like to have a script that does that, since I don’t really like having the trackpad activated as a button when I’m doing other stuff. Then I would turn it into an application and then I can add it to my top menu for quicker access.

Thank you so much and hope some can help me with that!
Tiago

You may try:


-- Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 23 juin 2020 17:30:39

set theBundle to ((path to library folder from system domain as string) & "PreferencePanes:Trackpad.prefPane:") as «class furl»
-- Extrct the local spelling of Trackpad
set trackPad_loc to localized string "CFBundleName" from table "InfoPlist" in bundle theBundle

tell application "System Preferences"
	activate
	-- id of every pane --> {"com.apple.preference.universalaccess", "com.apple.preferences.appstore", "com.apple.preferences.Bluetooth", "com.apple.preference.desktopscreeneffect", "com.apple.preference.digihub.discs", "com.apple.preference.keyboard", "com.apple.preferences.internetaccounts", "com.apple.preferences.parentalcontrols", "com.apple.preference.datetime", "com.apple.preference.startupdisk", "com.apple.preference.dock", "com.apple.preference.energysaver", "com.apple.preferences.extensions", "com.adobe.flashplayerpreferences", "com.apple.preference.general", "com.apple.preferences.icloud", "com.apple.preference.printfax", "com.oracle.java.JavaControlPanel", "com.apple.Localization", "com.apple.preference.expose", "com.apple.preference.displays", "com.apple.preference.notifications", "com.apple.preferences.sharing", "com.apple.preference.network", "com.apple.preference.security", "com.apple.preference.speech", "com.apple.preference.sound", "com.apple.preference.mouse", "com.apple.preference.spotlight", "com.apple.prefs.backup", "com.apple.preference.trackpad", "com.apple.preferences.users"}
	set current pane to pane id "com.apple.preference.trackpad"
	tell application "System Events" to tell process "System Preferences"
		set frontmost to true
		repeat until exists window trackPad_loc -- wait until the window Trackpad is available
			delay 0.1
		end repeat
		-- the disabled instructions show how we may learn which UI elements are available in th interface
		tell window trackPad_loc
			-- class of UI elements --> {button, button, static text, static text, tab, image, button, button, button, toolbar}
			tell tab group 1
				-- class of UI elements --> {radio button, radio button, radio button, checkbox, static text, menu button, checkbox, static text, menu button, checkbox, static text, static text, checkbox, static text, menu button, checkbox, static text, menu button, checkbox, static text, static text, checkbox, static text, static text, image}
				-- name of radio buttons --> {"Pointer et cliquer", "Faire défiler et zoomer", "Gestes supplémentaires"}
				click radio button 1 -- activate the pane Point & click if needed
				repeat until exists slider 1 -- wait until the wwanted pane is available
					delay 0.1
				end repeat
				-- class of UI elements --> --> {radio button, radio button, radio button, image, checkbox, static text, static text, checkbox, static text, menu button, checkbox, static text, static text, static text, static text, static text, slider}
				-- In this window the checboxes have no name.
				-- This is why I used the related static text to identify them
				-- name of static text (-2 + (1 * 2))--> "Recherche et détection de données"
				-- name of static text (-2 + (2 * 2))--> "Toucher avec 3 doigts"
				-- name of static text (-2 + (3 * 2))--> "Toucher pour cliquer"
				-- value of every checkbox--> {0, 1, 1}
				click checkbox 3 -- check/uncheck "Toucher pour cliquer"
			end tell -- tab group 1		
		end tell -- window trackPad_loc
	end tell -- application "System Events"
	quit
end tell -- application "System Preferences"

As always, several instructions used to build the code remain as disabled ones.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 23 juin 2020 16:49:24

You are the master!!!
Thank you so much for being so quick and also making it work flawlessly!
I would love to understand everything that’s in there, but I guess I’m not supposed to hahaha

Awesome job!!!

If I left the instructions used to build the script, it’s because I think that anybody is able to understand what is really done.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 23 juin 2020 17:40:56

You mean that those grey lines are just instructions?
I guess it’s the same as html comments, right?

And yes, it’s good to leave the instructions for other people :slight_smile:

Again, thank you so much for your time and help!

The lines in grey are disabled instructions.
You may delete the two dash at front of them to enable them.
I just added some extraneous comments in my original message.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 23 juin 2020 17:58:30