Force Messages to Stay Logged in on OSX
we have been using messages.app for communication in the office, but we often find that the client doesn't stay logged in. We have it set to auto-start at user login, we have it set to login when users resume activity, but many times, users still end up logged out. They don't realize it, and others in the office are trying to send them messages.
Is anyone aware of a way to force messages to stay logged in?
Solution 1:
You could run a script every minute to update the status to available.
To do this, save the following AppleScript, I called messages-available.scpt
, but your can rename if you want.
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 if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
Give permissions: chmod 775 messages-available.scpt
.
The script do click on Available menu item in Messages.
Go to folder /Users/your-username/Library/LaunchAgents
and save there the following plist file. I named it com.username.messages-available.plist
, but again, feel free to change it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.your-username.messages-available</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/your-username/bin/messages-available.scpt</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/com.your-username.messages-available.err</string>
<key>StandardOutPath</key>
<string>/tmp/com.your-username.messages-available.out</string>
</dict>
</plist>
The file is pretty self-explanatory. We will launch the command /usr/bin/osascript /Users/your-username/bin/messages-available.scpt
every 60 seconds, will be launched at load, will save errors on /tmp/com.username.messages-available.err
and logs on /tmp/com.username.messages-available.out
.
Replace your-username
appropriately.
Last step, tell the Mac launchd daemon to load it.
launchctl load com.your-username.messages-available.plist
To stop the script, just replace the word load
with unload
in the above sentence. When your restart your computer the script will be load again. To prevent it, move it to another folder.