There is a translation software called eudic, which copies the Chinese selected to the implementation and automatically inputs, but the input content is consistent and does not take effect, the command is as follows:
tell application "System Events"
tell application process "Eudic"
tell group 1 of text area 1 of group 1 of UI element 1 of scroll area 1 of front window
set value of static text 1 to "huangtingzhong"
end tell
end tell
end tell
After executing the above script, the contents of the software input box remain unchanged
I tested various methods and none of them currently work.
tell application "System Events"
tell application process "Eudic"
set frontmost to true
click button "清空" of front group of front UI element of front scroll area of front window
set value of front text area of front group of front UI element of front scroll area of front window to "huang"
end tell
end tell
Eudic isn't directly scriptable, so you are having to resort to User Interface scripting.
Instead, try doing it in KM. For example, a "Move or Click Mouse" action that selects the field by clicking the required number of pixels below the double-arrow, a ⌘A "Keystroke" action to select the contents, and an "Insert Text by Pasting" to add your text.
I clicked location in AppleScript, but the click operation still did not take effect, the script is as follows:
tell application "System Events"
tell application process "Eudic"
click button "清空" of front group of front UI element of front scroll area of front window
tell front text area of front group of front UI element of front scroll area of front window
set {xPosition, yPosition} to position
set {xSize, ySize} to size
end tell
tell application "System Events" to click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
tell application "System Events" to key code 9 using {command down}
end tell
end tell
After configuring focused, you can enter content in the text box
tell application "System Events"
tell application process "Eudic"
click button "翻 译" of toolbar 1 of front window
click button "清空" of group 1 of UI element 1 of scroll area 1 of front window
tell text area 1 of group 1 of UI element 1 of scroll area 1 of front window
set focused to true
set value to (the clipboard)
key code 36
end tell
end tell
end tell