Re: changing keyboard shortcut check boxes
Re: changing keyboard shortcut check boxes
- Subject: Re: changing keyboard shortcut check boxes
- From: "email@hidden" <email@hidden>
- Date: Thu, 3 Nov 2005 19:17:21 GMT
That almost worked perfectly. What I want is for the entire area to be turned OFF. However if not all of the items under "Keyboard Navigation" are turned ON, then the value of the check box is not 1, it is 0.5. And if I click on Keyboard Navigation when the value of the check box is 0.5, then all items underneath are turned ON. The check box needs to be clicked twice in that case to turn the entire submenu OFF. So I modified it to be as follows:
-----------------
-- get the keyboard preferences pane
tell application "System Preferences"
set current pane to pane "com.apple.preference.keyboard"
end tell
-- open the keyboard shortcuts menu
tell application "System Events" to tell process "System Preferences" to tell tab group 1 of window 1
-- move to keyboard shortcuts
click radio button "Keyboard Shortcuts"
-- check for keyboard navigation on
tell outline 1 of scroll area 1
tell (first row whose value of text field 1 is "Keyboard Navigation")
-- this will check if only some of the entries under keyboard navigation
-- are turned ON
if value of checkbox 1 is 0.5 then
select
-- this will turn all sub-entries ON
click checkbox 1
end if
-- this will check if all of the entries under keyboard navigation are
-- turned ON
if value of checkbox 1 is 1 then
select
-- this will turn all sub-entries OFF
click checkbox 1
end if
end tell
end tell
end tell
-----------------
Thanks for your help!
--Jennifer
-- kai <email@hidden> wrote:
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:
This email sent to email@hidden
___________________________________________________________________
Try Juno Platinum for Free! Then, only $9.95/month!
Unlimited Internet Access with 250MB of Email Storage.
Visit http://www.juno.com/value to sign up today!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden