Last Updated: February 25, 2016
·
1.748K
· erebusbat

Set HipChat Away /w AppleScript

Inspired by http://ertw.com/blog/2012/05/02/controlling-hipchat-status-through-applescript/

It needed some minor tweaking to make work:

#!/bin/zsh
STATUS=$1
if [ -z $STATUS ]; then
 STATUS="Available"
fi
TMPF=/tmp/ascript
cat > $TMPF <<-EOF
 tell application "System Events" to tell UI element "HipChat Mac" of list 1 of process "Dock"
 perform action "AXShowMenu"
 delay 0.5
 click menu item "Status" of menu 1
 click menu item "$STATUS" of menu 1 of menu item "Status" of menu 1
 end tell
 EOF
osascript $TMPF

It is limited, but better than nothing. The status must match EXACTLY the menu text if you right click on the HipChat icon on the dock. So.. no custom status messages, but better than nothing. Combined with ControlPlane I keep my team up to date.

1 Response
Add your response

Wanted something a little more, so hacked this together:

set cmd to "away"
tell application "HipChat"
 activate
 tell application "System Events"
 tell process "HipChat"
 set window_name to name of window 1
 end tell
 if window_name = "HipChat - Lobby" then
 tell process "HipChat"
 set tab_name to name of UI element 1 of row 2 of table 1 of scroll area 1 of splitter group 1 of window 1
 end tell
 keystroke "t" using command down
 keystroke tab_name
 keystroke return
 end if

 keystroke "/" & cmd
 keystroke return
 keystroke tab using command down
 end tell
end tell

You can actually pass messages as well if you really wanted to (set cmd to "away food")

over 1 year ago ·