macos - Apple Script 从代码块中获取结果值
问题描述
我有一段代码返回输入语言的当前值
tell process "SystemUIServer" to
get the value of the first menu bar item of menu bar 1
whose description is "text input"
tell end
现在我想检查结果,IF Else
但我不知道该怎么做!
谢谢
解决方案
首先,你必须告诉System Events
做这项工作。
只需将结果分配给变量
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set textInput to (get value of the first menu bar item of menu bar 1 whose description is "text input")
end tell
end tell
推荐阅读
- angular - 如何以角度动态命名元素
- google-apps-script - Google Scripts - 在 HTML.index 文件中使用动态 Javascript 变量
- json - 如何使用python3解析嵌套的json数据文件并将其插入sqlite数据库
- assembly - 如何修复 x86 程序集中中断 0x13 中的“无效命令”错误?(实模式)
- html - Doxygen 在@snippets 命令之后放置 HTML 标记
- javascript - 使用 Selenium 下载二进制文件的 JS 代码
- c++ - 为外部 DLL 设置 OMP 线程数
- android - Recyclerview:向下滚动
- javascript - 读入 CSV,Promise:变量声明
- serilog - 使用 Serilog 记录 EF Core sql 语句