Apple Script 从代码块中获取结果值

Apple Script get result value from block of code

我有一段代码 returns 输入语言的当前值

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