Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Toggle trackpad clicking via an AppleScript System
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.
    •    
  • Currently 4.00 / 5
  You rated: 5 / 5 (4 votes cast)
 
[10,649 views]  

Toggle trackpad clicking via an AppleScript | 4 comments | Create New Account
Click here to return to the 'Toggle trackpad clicking via an AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle trackpad clicking via an AppleScript
Authored by: benjaminooo on May 19, '06 08:20:27AM

I get an error for this on the click the keyboard & mouse part.. and in safari I can't select the entire code w/o going to "view source"



[ Reply to This | # ]
Toggle trackpad clicking via an AppleScript
Authored by: jwbales on May 19, '06 05:56:38PM
I solved the problem, it seems to be timing related, by inserting a one second delay before attempting to access the 'View' menu item. I also found that for my PowerBook G4 that a one second delay was also sufficient before attempting to client the 'Trackpad' tab group.
tell application "System Preferences"
	activate
end tell
tell application "System Events"
	tell process "System Preferences"
		delay 1
		click the menu item "Keyboard & Mouse" of the menu "View" of menu bar 1
		delay 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
tell application "System Preferences"
	quit
end tell


[ Reply to This | # ]
Toggle trackpad clicking via an AppleScript
Authored by: piyayo on May 19, '06 11:45:09AM

great hint. Thanks.
I've always wanted to script toggling processor performance from automatic to highest and viceversa but I had no idea the syntax was that simple. Well, it looks simple.

Is there somewhere where all these commands are explained?



[ Reply to This | # ]
Toggle trackpad clicking via an AppleScript
Authored by: covisp on May 21, '06 07:54:57AM

While the applescript is a good idea, what I do is have a Guest account active on my machine. That way none of my settings, startup applications, or what have you, will interfere with someone using the machine.

Switching logins is painless and easy, and easier that remembering what settings need to be changed.

In fact, it's so simple that if someone is going to use the machine for more thana few minutes, I just create an account for them.

---
http://www.covisp.net



[ Reply to This | # ]