I am using English as my primary system language and Chinese as my second. I believe there is a bug inside the Chinese language; although I already chose “Delete Hanzi” (under the drop menu), every time I restart my MacBook it turns back to “Reduce PinYin” (but it still shows “Delete Hanzi”). So the script would be launch everytime I start up the system and try to “refresh/reselect” the “Delete Hanzi”.
I do have UIElement from Apple installed in my MacBook and also checked the link you gave me; honestly, I really don’t know where to start. Mind guide me a little? Thank you very much again.
haven’t forgotten you, ive run into a wee snag, maybe some one else can help me past it, having a problem clicking the button “Modes” in he window that pops up after the script has run, any ideas please, tried a variety of ideas but all have failed.
UI Element Insp returns the below for the window in question.
------ THIS WILL CHECK TO SEE IF Enable access for assistive devices IS ON std ------
tell application "System Events" to set isUIScriptingEnabled to UI elements enabled
if isUIScriptingEnabled = false then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "Your system is not properly configured to run this script.
Please select the \"Enable access for assistive devices\"
checkbox and trigger the script again to proceed."
return
end tell
end if
---- THIS CHANGES THE PREFS ----
tell application "Finder"
activate
end tell
tell application "System Events" to tell menu bar 1 of application process "SystemUIServer"
repeat with _menu from 1 to count menu bar items
tell menu bar item _menu to if (get value of attribute "AXDescription") is "text input menu extra" then
click
(click menu item "Hanin" of menu 1)
delay 0.5
keystroke "U" using {option down, shift down}
delay 4
--having a wee bit of trouble getting the button "Modes" to click, working on it though
--some advice here please.
exit repeat
end if
end repeat
end tel
Actually, I was trying to use another way to overcome the “click-ness of the Mode” earlier this morning.
If the pref window which we are targeting at is opened, you press “tab once”, then “right arrow twice”, then press “space”, the Mode tab will open. However, I don’t know how to write the script. Hope this stupid method helps.
tell application "System Events"
keystroke tab
key code (ASCII character 29) -- right arrow
key code (ASCII character 29)
key code (ASCII character 32) -- space
end tell
most deffinitly not a stupid idea, it’s the clue I was after, the above didnt do it for me so changed to
tell application "System Events"
keystroke tab
key code 124 -- right arrow
key code 124
key code 49 -- space
end tell
Really can’t thank you more for all your big helps. I am now able to “refresh” the pref and run the script on the startup. Every time I saw the running process, I’ll remember all you kind help .