MacOS – From the command-line, how can I set all accounts to Available in all Messages.app

automationcommand linemacosmessages

Is there a scriptable way from the terminal I can tell Messages.app to take all my accounts online?

Best Answer

Executing this applescript all your account will be in available status:

tell application "System Events"
    tell process "Messages"
        tell menu bar 1
            tell menu bar item "Messages"
                tell menu "Messages"
                    tell menu item "My Status"
                        tell menu "My Status"
                            click menu item "Available"
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
end tell

You can save it as ~/turn_available.scpt and execute in the terminal with this command:

osascript ~/turn_available.scpt