Thankfully, you can still disable the trackpad in OS X Lion.
Open System Preferences, click on Universal Access, select Mouse & Trackpad and click on Trackpad Options... at the bottom. Tick the checkbox "Ignore built-in trackpad when mouse or wireless trackpad is present".
First, make sure Applescripts has permission to modify apps.
This can be done by opening System Preferences | Security & Privacy | Accessibility
and checking Script Editor. This is a one time process and you shouldn't have to check it again.
I ran this same snippet @Bowen provided in his question on Mojave and noticed what he described. I fixed it by adding the delay mentioned by @Bowen in his answer. The box would either check or uncheck now that we have added a small delay.
Here is that example I ran directly from Script Editor:
try
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell
delay 2
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 Preferences" to quit
end tell
end tell
end try
Also, In relation to this topic, I built something using ideas from this thread, since folks may want to automate it per their settings. The below script is "Automator ready", or can be exported as an application so you can run it at startup or however you want to execute it. You have to also allow access to the exported application as shown in the image above for "Scroll direction Clicker". This is specific to a Logitech mouse being found, but it can easily be modified to any other type of string/mouse type. It can also be used as a decent reference to build off of for scroll-direction. I for one got tired of flipping scroll-direction when going from mouse to trackpad, and that's how I found this thread.
Tailored to be exported as an Application from within Script Editor
try
set logitech to "Logitech"
try
set scriptOutput to do shell script "system_profiler SPUSBDataType | grep -i logitech"
if scriptOutput contains logitech then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell
delay 2
tell application "System Events"
tell process "System Preferences"
set checkBoxOne to checkbox 1 of tab group 1 of window "Trackpad"
click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
tell checkBoxOne to if value is 1 then click
tell application "System Preferences" to quit
end tell
end tell
end if
on error errMsg
log errMsg
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell
delay 2
tell application "System Events"
tell process "System Preferences"
set checkBoxOne to checkbox 1 of tab group 1 of window "Trackpad"
click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
tell checkBoxOne to if value is 0 then click
tell application "System Preferences" to quit
end tell
end tell
end try
end try
Best Answer
If you have a multi-touch trackpad Mac, the option no longer appears in System Preferences because it as enabled automatically. See https://support.apple.com/en-us/HT201822.
Update 2016-04-03-1007
You may want to give BetterTouchTool a try. It enables fine grained control of trackpad behavior. Three items that may interest you in particular: