Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andymadge/e3b7ff209a1581ed0544 to your computer and use it in GitHub Desktop.
Save andymadge/e3b7ff209a1581ed0544 to your computer and use it in GitHub Desktop.
Alfred workflow scripts for join.me. Place these in Run NSAppleScript actions
-- delay doesn't work properly on Yosemite so we need to override it.
-- See http://apple.stackexchange.com/questions/161749/applescript-delay-not-working-since-switch-to-yosemite
on delay duration
set endTime to (current date) + duration
repeat while (current date) is less than endTime
tell AppleScript to delay duration
end repeat
end delay
on alfred_script(q)
-- display alert "Argument is: " & q
if q is equal to "" then
-- must have been keyword with no arg so we need to get joinCode by copy
-- currently doesn't work the first time, you get the previous clipboard contents instead. Works on second run
tell application "System Events"
keystroke "c" using {command down}
end tell
set joinCode to the clipboard
else
-- joinCode was in query, either from hotkey or keyword arg
set joinCode to q
end if
-- display alert "joinCode is: " & joinCode
set appname to "join.me"
tell application appname to activate
delay 5
tell application "System Events"
tell process appname
set visible to true
set the clipboard to joinCode
tell application "System Events"
keystroke "v" using {command down}
end tell
click button 4 of window 1
end tell
end tell
end alfred_script
-- delay doesn't work properly on Yosemite so we need to override it.
-- See http://apple.stackexchange.com/questions/161749/applescript-delay-not-working-since-switch-to-yosemite
on delay duration
set endTime to (current date) + duration
repeat while (current date) is less than endTime
tell AppleScript to delay duration
end repeat
end delay
on alfred_script(q)
tell application "join.me" to activate
delay 5
tell application "System Events"
tell process "join.me"
set visible to true
click button 6 of window 1
end tell
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment