Last active
December 24, 2015 00:19
-
-
Save sbleon/6716003 to your computer and use it in GitHub Desktop.
Open a Google Hangout in full-screen mode in Safari
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Open a specific Google Hangout in Safari's full-screen mode. | |
See blog post at http://singlebrook.com/blog/google-hangouts-for-remote-worker-telepresence for more, | |
including: | |
- instructions for creating persistent hangouts | |
- keeping machines in the hangout | |
[email protected] | |
*) | |
-- CONFIGURE ME! | |
set hangout_url to "https://plus.google.com/hangouts/_/calendar/LONG_RANDOM_STRING" | |
-- END CONFIGURATION | |
tell application "Safari" | |
-- Check to see if Hangout is already open | |
activate | |
delay 2 | |
try | |
set currentURL to URL of current tab of front window | |
on error errMsg | |
set currentURL to "" | |
end try | |
if currentURL contains "plus.google.com" then | |
-- It's already open | |
else | |
-- It's not open. Open it! | |
open location hangout_url | |
delay 12 --Sometimes it takes a while to open fully | |
-- "Click" the Join button | |
activate | |
tell application "System Events" | |
keystroke tab | |
keystroke tab | |
keystroke tab | |
keystroke tab | |
keystroke tab | |
keystroke tab | |
keystroke return | |
end tell | |
end if | |
-- Check if it's already fullscreen | |
set isfullscreen to false | |
tell application "System Events" to tell process "Safari" | |
try | |
set isfullscreen to value of attribute "AXFullScreen" of window 1 | |
on error errMsg | |
-- The above command fails when it's already fullscreen | |
set isfullscreen to true | |
end try | |
end tell | |
if isfullscreen is false then | |
tell application "System Events" to keystroke "f" using {command down, control down} | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment