-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathskype_dialer.rb
More file actions
executable file
·46 lines (37 loc) · 1.11 KB
/
skype_dialer.rb
File metadata and controls
executable file
·46 lines (37 loc) · 1.11 KB
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
#!/usr/local/bin/macruby
framework 'Foundation'
framework "ScriptingBridge"
@sys_events = SBApplication.applicationWithBundleIdentifier("com.apple.systemevents")
@skype = SBApplication.applicationWithBundleIdentifier("com.skype.skype")
@skype.activate()
SCRIPT_NAME = "MacRubySkypeDialer"
class SBElementArray
def [](value)
self.objectWithName(value)
end
end
#get the running skype process
@skype_process = @sys_events.processes["Skype"]
def wait_for_ready
status = "COMMAND_PENDING"
while status == "COMMAND_PENDING"
status = @skype.sendCommand("GET USERSTATUS", :scriptName => SCRIPT_NAME)
if status == "COMMAND_PENDING"
dismiss_skype_api_security
end
#TODO how to get the results of sendCommand
puts status
sleep 0.5
end
end
def dismiss_skype_api_security
if(@skype_process.windows["Skype API Security"])
window = @skype_process.windows["Skype API Security"]
allow_button = window.radioGroups.first.radioButtons["Allow this application to use Skype"]
allow_button.click()
sleep 0.2
window.buttons["OK"].click()
end
end
wait_for_ready()
puts "ready"