Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vrillusions

macrumors regular
Original poster
Jul 8, 2007
227
2
Cleveland, Ohio, US
In other languages like python and php you can get a dump of every action available on an object. Like var_dump($_POST) in php or dir(os) in python. Is there something similar in applescript? What I'm trying to do is set the mouse sensitivity since I use the mighty mouse for day to day but a usb mouse for gaming and the sensitivities are really different. This is what I have so far:

Code:
tell application "System Preferences"
	activate
	set the current pane to pane id "com.apple.preference.mouse"
end tell

Which will open up the mouse preferences. Now I need a way to set the "tracking" slider to a certain value, probably 0.5 if I want it in the middle. How do I inspect the current pane to get a list of what values I can change and optionally what range they support?

*edit
Got a little closer. I think I need to fill in the blank for the statement: 'get the name of every ??? of pane id "com.apple.preference.mouse"' that would give me all the names and I can figure out which is for the tracking slider
 
Last edited:
So I finally figured it out. There is no vardump type command that I could find but you can kinda do it with UIElementInspector (google it, it's a sample code project from apple). that will at least give you a name if it exists. But ultimately I needed to use System Events and UI scripting. But I found out how to determine the names of sliders that the ui element inspector doesn't give. Here's the working code:

Code:
set tracking to 9

tell application "System Preferences"
	activate
	set current pane to pane id "com.apple.preference.mouse"
end tell

-- need a delay before UI Scripting
delay 1

tell application "System Events"
	tell process "System Preferences"
		-- This returns the name of "slider 1" used below
		-- get name of slider 1 of window "Mouse"
		set value of slider "Tracking" of window "Mouse" to tracking
	end tell
end tell

tell application "System Preferences" to quit
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.