IP Phone: Difference between revisions

From Medien Wiki
Line 7: Line 7:
Um über ein Klick den im OS X Adressbuch geöffneten Kontakt anzuwählen kann folgendes AppleScript verwendet werden, es kann als <tt>Call with IP Phone.scpt</tt> in <tt>~/Library/Address Book plugins/</tt> gelegt werden. Voraussetzung für das Funktionieren des Scripts ist, dass man schon die Sicherheitszertifikate der Webdialer-URL mit Safari importiert hat und dass man in dort schon eingeloggt ist (Login muss beim [[SCC-Services|SCC]] beantragt werden).
Um über ein Klick den im OS X Adressbuch geöffneten Kontakt anzuwählen kann folgendes AppleScript verwendet werden, es kann als <tt>Call with IP Phone.scpt</tt> in <tt>~/Library/Address Book plugins/</tt> gelegt werden. Voraussetzung für das Funktionieren des Scripts ist, dass man schon die Sicherheitszertifikate der Webdialer-URL mit Safari importiert hat und dass man in dort schon eingeloggt ist (Login muss beim [[SCC-Services|SCC]] beantragt werden).


<source lang="applescript">
<source lang="applescript">set safariWasRunning to false
-- AppleScript(+JavaScript) to dial phone numbers with a Cisco IP Phone from the Mac OS Address Book via the Webdialer URL
-- AppleScript(+JavaScript) to dial phone numbers with a Cisco IP Phone from the Mac OS Address Book via the Webdialer URL
-- 2011 Max Neupert, Bauhaus-Universität Weimar with the help of the world wide web and Google
-- 2011 Max Neupert, Bauhaus-Universität Weimar with the help of the world wide web and Google
Line 26: Line 26:
on perform action for p with e
on perform action for p with e
set safariWasRunning to false
if appIsRunning("Safari") then
set safariWasRunning to true
else
tell application "Safari"
activate
delay 0.5
end tell
end if
set theNumberInAddressBook to value of e
set theNumberInAddressBook to value of e
set amtsholung to true
set amtsholung to true
Line 40: Line 49:
else if theNumberInAddressBook begins with "+" then
else if theNumberInAddressBook begins with "+" then
set theFormattedNumber to "00" & characters -1 thru -(lengthOfNumber - 1) of theNumberInAddressBook
set theFormattedNumber to "00" & characters -1 thru -(lengthOfNumber - 1) of theNumberInAddressBook
else
set theFormattedNumber to theNumberInAddressBook
end if
end if
Line 56: Line 67:
end if
end if
tell application "Safari"
tell application "Safari"
activate
open location "https://telefon.uni-weimar.de/webdialer/Webdialer"
open location "https://telefon.uni-weimar.de/webdialer/Webdialer"
Line 73: Line 83:
end perform action
end perform action
end using terms from
end using terms from
--from http://codesnippets.joyent.com/posts/show/1124
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
</source>
</source>