Apple Script从代码块获取结果值

时间:2019-01-26 07:27:47

标签: macos applescript

我有一段代码可以返回输入语言的当前值

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检查结果,但是我不知道该怎么做!

谢谢

1 个答案:

答案 0 :(得分:1)

首先,您必须告诉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