View Single Post
mtmanner

 
Member Since: Feb 09, 2012
Posts: 1
mtmanner is on a distinguished road

mtmanner is offline
I have a script that was working fine in Snow Leopard. Can't figure out why it isn't functioning in Lion.

Thoughts?

Here's the script -- designed to toggle the "tap to click" box on the trackpad (using an MBA2011: 10.7.2)

-- want it on or off?
display dialog "Turn trackpad-clicking on or off?" buttons {"Cancel", "Turn Off", "Turn On"} default button 3 with icon note
if (button returned of result) is "Turn On" then
set theValue to 1
else
set theValue to 0
end if

-- open the preference pane
tell application "System Preferences"
activate
reveal (pane id "com.apple.preference.trackpad")
end tell

tell application "System Events"
tell process "System Preferences"
-- check the current value of the checkbox and change it if needed
tell checkbox "Clicking" of group 1 of window 1
repeat until exists (* wait until the object is accessible *)
delay 0.2
end repeat
if value is not theValue then click
end tell

-- leave the trackpad preference pane
click button "Show All" of group 1 of group 2 of tool bar 1 of window 1

-- hide system preferences
set visible to false
end tell
end tell
QUOTE Thanks