如何使用AppleScript将获取值分配给变量?

时间:2018-09-01 02:23:14

标签: applescript

如何将first menu bar item of menu bar 1 whose description is "text input"的值赋值给另一个变量?

tell application "System Events"
    tell process "SystemUIServer"
        get value of first menu bar item of menu bar 1 whose description is "text input"
    end tell
end tell

1 个答案:

答案 0 :(得分:1)

get value of ...作为输出,并以通常的方式将值分配给变量。不要忘记在get value of ...

之间放置括号
tell application "System Events"
    tell process "SystemUIServer"
        set inputValue to (get value of first menu bar item of menu bar 1 whose description is "text input")            

        return inputValue
    end tell
end tell