forked from yargevad/rc-conf-dial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
joinmeeting.scpt
executable file
·60 lines (53 loc) · 1.7 KB
/
joinmeeting.scpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/osascript
-- This script exists because RingCentral's "launch from browser"
-- doesn't currently work with Google Chrome (2015-03-19).
--
-- Patches accepted.
--
-- how to specify arguments to an applescript ... script:
-- http://stackoverflow.com/a/16977401/857156
on run { meetcode }
-- validate meetcode (10 digits)
if not isNumericString(meetcode, 10) then
return "ERROR: second argument must be a 10-digit meeting code!"
end if
tell application "RingCentral Meetings.app"
activate
tell application "System Events" to tell process "RingCentral Meetings"
-- use "Window" menu to make sure "RingCentral Meetings" is focused
-- since it gets auto-minimized sometimes
tell menu 1 of menu bar item "Window" of menu bar 1
click
-- GRR: why doesn't this work?!
--set xxx to menu item whose name contains "RingCentral Meetings"
-- sigh, get the menu item indirectly
set separator to last menu item where title is ""
click menu item after separator
end tell
tell menu bar item "RingCentral Meetings" of menu bar 1
click
click menu item "Join Meeting..." of menu 1
end tell
keystroke meetcode
--key code 48 -- tab
--keystroke "a" using {command down}
--keystroke "Your Full Name"
key code 36 -- enter
end tell
end tell
return -- default to empty return value
end run
-- validation functions:
on isNumericString(str, len)
set {n, isOk} to {length of str, true}
if n is not equal to len then return false
try
repeat with i from 1 to n
set isOk to ((character i of str) is in "0123456789")
if isOk = false then return false
end repeat
return true
on error
return false
end try
end isNumericString