Keyboard & Mouse System Preferences

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

Hi,

first of all: welcome to MacScripter :slight_smile:
second of all: A short description of the purpose of the script might be nice
third of all: The Code Exchange forum is actually the respective forum to post code to share

Moved to correct forum.