Just sharing.
set trackingValue to 7
set paneName to "com.apple.preference.keyboard"
set windowName to "Keyboard & Mouse"
set isRunningSystemPreferences to 0
set originalPaneId to 0
tell application "System Events"
try
set isRunningSystemPreferences to id of process "System Preferences"
end try
tell application "System Preferences"
activate
if isRunningSystemPreferences is not equal to 0 then
try
set originalPaneId to get id of current pane
end try
end if
set current pane to pane id paneName
-- get the name of every anchor of pane id mousePane
reveal anchor "mouseTab" of pane id paneName
end tell
tell process "System Preferences"
tell tab group of window windowName
set value of slider 1 to trackingValue
end tell
end tell
tell application "System Preferences"
if isRunningSystemPreferences is equal to 0 then
quit
else
if originalPaneId is not equal to 0 then
set current pane to pane id originalPaneId
end if
end if
end tell
end tell