I need help with AppleScript or Terminal command to toggle trackpad options in System Preferences

Hi everyone, hope you are all doing great..

I'm having a problem with the trackpad gestures pinch-to-zoom & swipe-between-pages for a long time, and I found it's a known macOS problem with some apps but I was too lazy to search for a solution, and to fix it I was either toggle some trackpad options in System Preferences or have the mac go to sleep.

So right now I'm trying to find a solution by writing an AppleScript or Terminal command to toggle them (Tap To Click & Zoom in or out). I will attach bellow a screenshot for them. and btw I'm on macOS Mojave.

I could not yet figure a way to write it as I'm not familiar enough with them. So I would really appreciate any help.

Thanks..


I found an AppleScript online that do the trick by opening System Preferences, tick the option and close the System Preferences again.

tell application "System Preferences"
	reveal anchor "trackpadTab" of pane id "com.apple.preference.trackpad"
	activate
end tell
tell application "System Events"
	tell process "System Preferences"
		click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
		click checkbox 2 of tab group 1 of window "Trackpad"
	end tell
end tell
tell application "System Preferences"
	quit
end tell

I need something simpler to do that on the background if possible, rather than this way as it will have many fail cases for me..

if any one is familiar with AppleScript I would really appreciate a help with this. Thanks.