Scripting check box

Hello all
I thought this was going to be a simple script for a check box, but I have hit a snag:

tell application "System Events"
	tell application process "System Preferences"
		set state of checkbox "Show input menu in menu bar" of tab group 1 of window "international" to 1
	end tell
end tell

The script editor colors the command “state” green as if it were a variable and returns the following error when run:

tell application "System Events"
	set state of checkbox "Show input menu in menu bar" of tab group 1 of window "international" of application process "System Preferences" to 1
		"System Events got an error: NSCannotCreateScriptCommandError"

One final thing. I ran the following script to make sure the script saw the check box:

tell application "System Events"
	tell application process "System Preferences"
		exists checkbox "Show input menu in menu bar" of tab group 1 of window "international"
	end tell
end tell

It returned “True”

Thanks in advance for your help

Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051107 Camino/1.0b1
Operating System: Mac OS X (10.4)

System Events doesn’t have a “state” property.

If you just want to toggle the checkbox, this will work:

tell application "System Preferences"
	activate
	set current pane to pane "com.apple.Localization"
	reveal (first anchor of current pane whose name is "InputMenu")
end tell

tell application "System Events"
	launch
	tell process "System Preferences" to click checkbox 1 of tab group 1 of window 1
	--quit
end tell

--quit application "System Preferences"

I tried to use this instead of clicking:

set value to (value + 1) mod 2

. but it didn’t seem to have any effect.

If you’re trying to ensure that the box is checked (instead of toggling it), you can try something like this:

tell application "System Preferences"
	activate
	set current pane to pane "com.apple.Localization"
	reveal (first anchor of current pane whose name is "InputMenu")
end tell

tell application "System Events"
	launch
	tell process "System Preferences" to tell checkbox 1 of tab group 1 of window 1
		if value is 0 then click
	end tell
	--quit
end tell

--quit application "System Preferences"