XYZ
XYZ

Reputation: 27437

How to assign get value to a variable using AppleScript?

How to assign value get from first menu bar item of menu bar 1 whose description is "text input" to another variable?

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

Upvotes: 1

Views: 2530

Answers (1)

XYZ
XYZ

Reputation: 27437

Treat get value of ... as the output and assign the value to the variable in a usual way. do not forget to place parentheses between 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

Upvotes: 2

Related Questions