Applescript Snow Leopard to Lion

Joined
Feb 9, 2012
Messages
1
Reaction score
0
Points
1
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
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top