Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing keyboard shortcut check boxes




On 31 Oct 2005, at 17:22, email@hidden wrote:

Hi! I am trying to turn off some keyboard shortcuts if they have been selected and I am having a problem where my code seems to only turn off the check box of whatever row is currently highlighted. I am looping through each row checking for the "Keyboard Navigation" line. However, if last I had the "Input Menu" line highlighted for example and it is currently turned ON, that one seems to be the one that is turned OFF. Is there something I am missing to highlight the line I want before clicking the check box, or something wrong with my code to click on the correct check box? I am running OS 10.4.2, AppleScript 1.10, and ScriptEditor 2.1.

Not much about this sort of stuff is that obvious or intuitive, Jennifer - so don't feel too bad about it. :-)


In fact, you're already very close. Your observation about the click affecting the highlighted row is spot on - as is your question about how to select the required row. You can achieve the latter in one or two ways - perhaps most directly by using the 'select' command.

A couple of other minor points. It's not essential to explicitly activate System Preferences to perform operations like this (unless you prefer to - or need to for some other purpose). Neither is it strictly necessary to loop through each row to identify the required one - since you could filter it instead:

----------------

tell application "System Preferences" to set current pane to pane "com.apple.preference.keyboard"
tell application "System Events" to tell process "System Preferences" to tell tab group 1 of window 1
click radio button "Keyboard Shortcuts"
tell outline 1 of scroll area 1
tell (first row whose value of text field 1 is "Keyboard Navigation")
if value of checkbox 1 is 1 then
select
click checkbox 1
end if
end tell
end tell
end tell


----------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >changing keyboard shortcut check boxes (From: "email@hidden" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.