Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Applescript Snow Leopard to Lion (http://www.mac-forums.com/forums/os-x-development-darwin/266208-applescript-snow-leopard-lion.html)

mtmanner 02-09-2012 01:50 PM

Applescript Snow Leopard to Lion
 
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


All times are GMT -4. The time now is 05:54 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.