text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
if button returned of b is "UnMute Mic" then
|
Deskpro Volume Utility v2.scpt
|
set myCmd to {"Command", "Audio", "Microphones", "UnMute"}
|
Deskpro Volume Utility v2.scpt
|
else if button returned of b is "UnMute Vol" then
|
Deskpro Volume Utility v2.scpt
|
set myCmd to {"Command", "Audio", "Volume", "UnMute"}
|
Deskpro Volume Utility v2.scpt
|
else if button returned of b is "UnMute All" then
|
Deskpro Volume Utility v2.scpt
|
set my2ndCmd to {"Command", "Audio", "Volume", "UnMute"}
|
Deskpro Volume Utility v2.scpt
|
else if button returned of b is "Mute Mic" then
|
Deskpro Volume Utility v2.scpt
|
set myCmd to {"Command", "Audio", "Microphones", "Mute"}
|
Deskpro Volume Utility v2.scpt
|
else if button returned of b is "Mute Vol" then
|
Deskpro Volume Utility v2.scpt
|
set myCmd to {"Command", "Audio", "Volume", "Mute"}
|
Deskpro Volume Utility v2.scpt
|
else if button returned of b is "Mute All" then
|
Deskpro Volume Utility v2.scpt
|
set my2ndCmd to {"Command", "Audio", "Volume", "Mute"}
|
Deskpro Volume Utility v2.scpt
|
set myCmd to {"Command", "Call", "Disconnect"}
|
Deskpro Volume Utility v2.scpt
|
set the2ndVar to theMacVolume
|
Deskpro Volume Utility v2.scpt
|
if action is "getPrefs" then
|
Deskpro Volume Utility v2.scpt
|
set theHost to do shell script "defaults read com.cisco." & quoted form of prefsName & " hostname"
|
Deskpro Volume Utility v2.scpt
|
on error -- no previous username entry
|
Deskpro Volume Utility v2.scpt
|
display dialog "The Script was unable to read your preferences." & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "Please have the following information available for input." & return & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "Deskpro hostname or IP address:" & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "Deskpro Username:" & return & "Deskpro password for user:" & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "Ignore Self Signed Cert Yes/No:" & return & "Auto Answer Calls Yes/No:" & return & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "If you want to control a TP-Link Device: Yes/No" & return & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "If you selected yes to control the TP-Link Device you will need:" & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "TP-Link KASA ID:" & return & "TP-Link Device ID(s):" & return & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "You can select \"Cancel\" if you do not have this information available now." & return & return ¬
|
Deskpro Volume Utility v2.scpt
|
& "Instructions are located at the top of the script, open with a text application or script editor to read." with title name of me
|
Deskpro Volume Utility v2.scpt
|
set theUser to do shell script "defaults read com.cisco." & quoted form of prefsName & " username"
|
Deskpro Volume Utility v2.scpt
|
try -- check to see if a base64url has been previously saved
|
Deskpro Volume Utility v2.scpt
|
set myBase64Url to do shell script "security find-generic-password -wl " & quoted form of prefsName & "." & theUser
|
Deskpro Volume Utility v2.scpt
|
on error -- no previous base64url in keychain
|
Deskpro Volume Utility v2.scpt
|
set tryPWD to ""
|
Deskpro Volume Utility v2.scpt
|
repeat until tryPWD is true
|
Deskpro Volume Utility v2.scpt
|
display notification ("Calculating base64url") with title name of me
|
Deskpro Volume Utility v2.scpt
|
set myBase64Url to do shell script "printf " & theUser & ":" & thePwd & " | base64"
|
Deskpro Volume Utility v2.scpt
|
do shell script "security add-generic-password -a " & quoted form of prefsName & " -w " & quoted form of myBase64Url & " -j 'Used by Applescript Deskpro Volume' -s" & quoted form of prefsName & "." & theUser
|
Deskpro Volume Utility v2.scpt
|
try -- check to see if ignore self_signed_cert has been set
|
Deskpro Volume Utility v2.scpt
|
set selfcert to do shell script "defaults read com.cisco." & quoted form of prefsName & " ignore_self_signed_cert"
|
Deskpro Volume Utility v2.scpt
|
on error -- no previous autoanswer entry to ignore the self signed cert we inject a -k into the curl commands
|
Deskpro Volume Utility v2.scpt
|
set b to display dialog ("Do you want the script to ignore the default Deskpro Self Signed Cert?" & return & return & " Set this to no if you have a valid cert on the deskpro") buttons {"Yes", "No"} default button "Yes" with title name of me
|
Deskpro Volume Utility v2.scpt
|
set selfcert to "-k"
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " ignore_self_signed_cert" & " '-k'"
|
Deskpro Volume Utility v2.scpt
|
set selfcert to ""
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " ignore_self_signed_cert" & " ''"
|
Deskpro Volume Utility v2.scpt
|
try -- check to see if Auto Answer has been set
|
Deskpro Volume Utility v2.scpt
|
set AutoAnswer to do shell script "defaults read com.cisco." & quoted form of prefsName & " AutoAnswer"
|
Deskpro Volume Utility v2.scpt
|
on error -- no previous autoanswer entry
|
Deskpro Volume Utility v2.scpt
|
try -- check to see if a call volume has been previously saved
|
Deskpro Volume Utility v2.scpt
|
set theCallVolume to do shell script "defaults read com.cisco." & quoted form of prefsName & " volume_call"
|
Deskpro Volume Utility v2.scpt
|
set b to display dialog ("What is your preferred volume while in a call?") default answer "55" with title name of me
|
Deskpro Volume Utility v2.scpt
|
set theCallVolume to text returned of b
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " volume_call" & " '" & theCallVolume & "'"
|
Deskpro Volume Utility v2.scpt
|
try -- check to see if a Mac Volume has been previously saved
|
Deskpro Volume Utility v2.scpt
|
set theMacVolume to do shell script "defaults read com.cisco." & quoted form of prefsName & " volume_Mac"
|
Deskpro Volume Utility v2.scpt
|
set b to display dialog ("What is your preferred volume for Mac Speaker output?") default answer "20" with title name of me
|
Deskpro Volume Utility v2.scpt
|
set theMacVolume to text returned of b
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " volume_Mac" & " '" & theMacVolume & "'"
|
Deskpro Volume Utility v2.scpt
|
if (do shell script "defaults read com.cisco." & quoted form of prefsName & " tplink_control") is "1" then
|
Deskpro Volume Utility v2.scpt
|
set myTPLinkDevices to do shell script "defaults read com.cisco." & quoted form of prefsName & " TPLink_devices"
|
Deskpro Volume Utility v2.scpt
|
set newTPLinkDevice to "1"
|
Deskpro Volume Utility v2.scpt
|
set myTPLinkDevices to {}
|
Deskpro Volume Utility v2.scpt
|
repeat until newTPLinkDevice is ""
|
Deskpro Volume Utility v2.scpt
|
set newTPLinkDevice to display dialog "Enter your TP-Link device Id" default answer "" with title name of me
|
Deskpro Volume Utility v2.scpt
|
set newTPLinkDevice to text returned of newTPLinkDevice
|
Deskpro Volume Utility v2.scpt
|
if newTPLinkDevice is not "" then
|
Deskpro Volume Utility v2.scpt
|
set the end of myTPLinkDevices to newTPLinkDevice & "\\r"
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " TPLink_devices" & " '" & myTPLinkDevices & "'"
|
Deskpro Volume Utility v2.scpt
|
set c to display dialog ("Do you want the script to control an In-Call Status Light?") buttons {"Yes", "No"} default button "Yes" with title name of me
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " tplink_control" & " '1'"
|
Deskpro Volume Utility v2.scpt
|
do shell script "defaults write com.cisco." & quoted form of prefsName & " tplink_control" & " '0'"
|
Deskpro Volume Utility v2.scpt
|
on post_cmd()
|
Deskpro Volume Utility v2.scpt
|
set myCmdStart to {}
|
Deskpro Volume Utility v2.scpt
|
set myCmdEnd to {}
|
Deskpro Volume Utility v2.scpt
|
set newCmd to items of myCmd
|
Deskpro Volume Utility v2.scpt
|
repeat with newElement in newCmd
|
Deskpro Volume Utility v2.scpt
|
if newElement is not "" then
|
Deskpro Volume Utility v2.scpt
|
set the end of myCmdStart to "<" & newElement & ">"
|
Deskpro Volume Utility v2.scpt
|
if newElement contains "Set command=\"True\"" then
|
Deskpro Volume Utility v2.scpt
|
set newElement to "Set"
|
Deskpro Volume Utility v2.scpt
|
set the beginning of myCmdEnd to "</" & newElement & ">"
|
Deskpro Volume Utility v2.scpt
|
set postCmd to selfcert & " --location --request POST \"https://" & theHost & "/putxml\" --header 'Authorization: Basic " & myBase64Url & "' --header 'Content-Type: text/plain' --data-raw '" & myCmdStart & theVar & myCmdEnd & "' "
|
Deskpro Volume Utility v2.scpt
|
if my2ndCmd is not {} then
|
Deskpro Volume Utility v2.scpt
|
set my2ndCmdStart to {}
|
Deskpro Volume Utility v2.scpt
|
set my2ndCmdEnd to {}
|
Deskpro Volume Utility v2.scpt
|
set new2ndCmd to items of my2ndCmd
|
Deskpro Volume Utility v2.scpt
|
repeat with new2ndElement in new2ndCmd
|
Deskpro Volume Utility v2.scpt
|
if new2ndElement is not "" then
|
Deskpro Volume Utility v2.scpt
|
set the end of my2ndCmdStart to "<" & new2ndElement & ">"
|
Deskpro Volume Utility v2.scpt
|
if new2ndElement contains "Set command=\"True\"" then
|
Deskpro Volume Utility v2.scpt
|
set new2ndElement to "Set"
|
Deskpro Volume Utility v2.scpt
|
set the beginning of my2ndCmdEnd to "</" & new2ndElement & ">"
|
Deskpro Volume Utility v2.scpt
|
set postCmd to postCmd & " -: " & selfcert & " --location --request POST \"https://" & theHost & "/putxml\" --header 'Authorization: Basic " & myBase64Url & "' --header 'Content-Type: text/plain' --data-raw '" & my2ndCmdStart & the2ndVar & my2ndCmdEnd & "'"
|
Deskpro Volume Utility v2.scpt
|
end post_cmd
|
Deskpro Volume Utility v2.scpt
|
on get_xml()
|
Deskpro Volume Utility v2.scpt
|
set grep_for to " -e \"<Status>\" -e \"Duration\" -e \"Answer\" -e \"Mute\" -e \"VolumeInternal\" "
|
Deskpro Volume Utility v2.scpt
|
set theStatusResults to paragraphs of (do shell script "curl -k --location --request GET \"https://" & theHost & "/getxml?location=/Status\" --header 'Authorization: Basic " & myBase64Url & "' | grep " & grep_for)
|
Deskpro Volume Utility v2.scpt
|
set muteStatus to word 4 of item 9 of theStatusResults
|
Deskpro Volume Utility v2.scpt
|
set theCurrVolume to word 4 of item 10 of theStatusResults
|
Deskpro Volume Utility v2.scpt
|
set theVolMute to word 4 of item 11 of theStatusResults
|
Deskpro Volume Utility v2.scpt
|
set answeredState to word 4 of item 13 of theStatusResults
|
Deskpro Volume Utility v2.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.