Scripting System Perferences

Hello, I am a novice to scripting but I have been able to do what needed to in the past. But i am stumped on trying to select input menu button of the international window of system preferences. Here is the code:

tell application “System Preferences”
activate
tell application “System Events”
tell process “System Preferences”
click button “Displays” of scroll area 1 of window “System Preferences”
delay 2
tell application “System Events”
tell process “System Preferences”
tell button 1
click button “Input Menu” of TabGroup of window “International”
end tell
end tell
end tell

The problem child id this line of code:

click button “Input Menu” of TabGroup of window “International”

If anyone has any solutions please let me know.

Thank You,
MacNut

Model: G4 867
AppleScript: Tiger 10.4
Browser: Safari 412
Operating System: Mac OS X (10.4)

First of all, you’re telling System Preferences to click an element in the “International” window, but you haven’t opened that window yet; your code says:

Also, the Input button is a radio button, and that group of radio buttons is a tab group, not a TabGroup (I don’t think case matters, but the lack of a space turns the element into a variable name in your code).

This worked for me:

tell application "System Preferences"
	activate
	tell application "System Events"
		tell process "System Preferences"
			click button "International" of scroll area of window "System Preferences"
			delay 2
			click radio button "Input Menu" of tab group of window "International"
		end tell
	end tell
end tell

If you’re using UIElementInspector to figure out the object hierarchy of interface elements, the Processes Suite in System Events’ dictionary is a necessary (if evil) supplement.

Browser: Safari 125.12
Operating System: Mac OS X (10.3.8)

Thanks for quick Response!!!

I’ll correct the script tonight and try it. The goal is to try switch between english and russian keyboard layout with typing the Control -Shift keys.

So i am sure I’ll probably have more questions.

Thanks again,
MacNut

Model: Mac 867
AppleScript: 10.4
Browser: Safari
Operating System: Mac OS X (10.4)