*** EDIT - I RESOLVED IT – THE DELAY I WROTE IN WASN’T LONG ENOUGH. WORKS GREAT NOW. ***
trying to build a script to toggle (or at least hit) the trackpad clicking setting in the keyboard & mouse pref pane. (yes “enable access for assistive devices is checked” and yes i’ve run with and without the checkbox actually checked)
i wrote it based on and example in The Missing Manual, and after searching all relevant forums here and code exchange (sorry if i missed it but i was pretty thorough), i can’t find how to fix the problem. after reading the posting http://bbs.applescript.net/viewtopic.php?pid=58085, i believe i may have a mis-refernce, but after using UIElementsInspector many times and confirming what i think should be the name and group of the checkbox i want, i still get the error “NSReceiverEvaluationScriptError: 4”
SCRIPT
here’s the script so far:
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click the menu item "Keyboard & Mouse" of the menu "View" of menu bar 1
click the radio button "Trackpad" of the first tab group of window "Keyboard & Mouse"
click the checkbox "Clicking" of the first group of the first tab group of the window "Keyboard & Mouse"
end tell
end tell
WORKAROUNDs
i’ve changed the “Clicking” line several times to be the first, second, and third group (thinking that perhaps the sliders counted as a similar group), i’ve tried it with and without pauses of 2 and 4 seconds, and i’ve had it just as the checkbox of the window - all get the same error.
i’ve also tried a different strategy, to use mouseclick as described at http://bbs.applescript.net/viewtopic.php?id=10821 - but both with and without using “set frontmost to true,”
script editor says it doesn’t like the { character of my line
mouse click {279, 332}
(which of course replaced the “Clicking” line above.)
any help much appreciated.