Toggle trackpad clicking via an AppleScript

May 19, '06 07:30:06AM

Contributed by: fogboy

Occasionally, I let other people (my partner, co-workers) hop on my PowerBook to look something up, or write a quick email, etc. My practice of keeping the trackpad on clicking mode can be annoying (and confusing) to those who don't use it, or who don't even know it's possible, as they inadvertentlly click on something they didn't mean to. Yet for me, drilling down into the Keyboard & Mouse preference pane and unchecking the "Clicking" box was more time consuming and than I'd like.

The following AppleScript was for me an elegant solution, hope others may fine it useful. It's especially useful with Quicksilver, since I can just invoke Quicksilver, hit t-o-g-Return (which finds the script I've named "Toggle Trackpad Clicking"), and it's done.

How to use:

  1. Copy the script:

    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
        delay 4
        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
    tell application "System Preferences"
      quit
    end tell

  2. Paste the code into Script Editor (in /Applications -> AppleScript).

  3. Save to a convenient place, choosing "Application" from the File Format pull-down menu in the Save dialog.
Important: for the script to work, you must have "Enable access for assistive devices" checked in the Universal Access System Preferences pane. Also, your mileage may vary and it's possible the delay written into the script will need to be longer or shorter for it to work on your machine.

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060516085755886