将表情符号插入焦点文本输入
Insert emoji into focused text input
如何制作将表情符号插入焦点文本字段的 applescript?
我试过了
tell application "System Events" to keystroke "" & return
但这会输入 "aa"
而不是我想要的表情符号。
你不能用 keystroke
做到这一点。
或者将对应的UI元素的属性AXSelectedText
的值设置为例如字符
activate application "TheApp"
tell application "System Events"
tell process "TheApp"
set value of attribute "AXSelectedText" of text field 1 of window 1 to ""
keystroke return
end tell
end tell
您可以使用 UIElementInspector 或 UI 浏览器确定对 UI 元素的引用。
或使用剪贴板:
set the clipboard to ""
tell application "System Events"
keystroke "v" using command down
keystroke return
end tell
如何制作将表情符号插入焦点文本字段的 applescript?
我试过了
tell application "System Events" to keystroke "" & return
但这会输入 "aa"
而不是我想要的表情符号。
你不能用 keystroke
做到这一点。
或者将对应的UI元素的属性AXSelectedText
的值设置为例如字符
activate application "TheApp"
tell application "System Events"
tell process "TheApp"
set value of attribute "AXSelectedText" of text field 1 of window 1 to ""
keystroke return
end tell
end tell
您可以使用 UIElementInspector 或 UI 浏览器确定对 UI 元素的引用。
或使用剪贴板:
set the clipboard to ""
tell application "System Events"
keystroke "v" using command down
keystroke return
end tell