Skip to content

Instantly share code, notes, and snippets.

@BrettBukowski
Last active December 19, 2015 07:38
Show Gist options
  • Save BrettBukowski/5919695 to your computer and use it in GitHub Desktop.
Save BrettBukowski/5919695 to your computer and use it in GitHub Desktop.
LaunchAgent to auto-invoke applescript opening Google Hangout
<?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>Launch Daily Standup Hangout</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/brettb/launchStandupHangout.scpt</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Weekday</key>
<integer>1</integer>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>58</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>2</integer>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>58</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>3</integer>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>58</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>4</integer>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>58</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>5</integer>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>58</integer>
</dict>
</array>
</dict>
</plist>
on run argv
set location to "https://plus.google.com/hangouts/_/e5004c1b005ddf21"
if length of argv > 0 then set location to item 1 of argv
tell application "System Events"
tell application "Safari" to activate
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
tell application "Safari"
set URL of document 1 to location
end tell
end run
@BrettBukowski
Copy link
Author

This system auto-launches Safari to a Google Hangout every weekday at 9:58 am.

  1. Drop the plist file into ~/Library/LaunchAgents/
  2. Register it (via command line): launchctl load ~/Library/LaunchAgents/Launch\ Google\ Hangout.plist

launchStandupHangout.scpt has the added benefit of using a passed-in URL to navigate the browser to instead.

e.g.

osascript ~/launchStandupHangout.scpt -> goes to the default URL specified on line 2.

osascript ~/launchStandupHangout.scpt 'http://google.com' -> goes to google.com instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment