- Code: Select all
using terms from application "IndigoServer"
tell application "IndigoServer"
if value of variable "vauxResponse" contains "!s" then
set vauxResponseString to value of variable "vauxResponse"
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxResponseString
end if
set {myTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {","}}
set myList to text items of vauxResponseString
set AppleScript's text item delimiters to myTID -- It's considered good practice to return the TID's to their original state
--log list of myList
--if myList contains less than 5 items then
stop
end if
try
if item 2 of myList is "40" then --this is for setting bass and treble.
set vauxZoneNumber to item 3 of myList
set vauxBassSetting to item 4 of myList
set vauxTrebleSetting to item 5 of myList as string
log ((vauxZoneNumber as string) & " " & (vauxBassSetting as string) & " " & (vauxTrebleSetting as string))
if vauxZoneNumber is "0" then set value of variable "vauxZoneName" to "Off" as text
if vauxZoneNumber is "1" then set value of variable "vauxZoneName" to "Kitchen" as text
if vauxZoneNumber is "2" then set value of variable "vauxZoneName" to "FamRm" as text
if vauxZoneNumber is "3" then set value of variable "vauxZoneName" to "Study" as text
if vauxZoneNumber is "4" then set value of variable "vauxZoneName" to "LivDnRm" as text
if vauxZoneNumber is "5" then set value of variable "vauxZoneName" to "GameRm" as text
if vauxZoneNumber is "6" then set value of variable "vauxZoneName" to "Patio" as text
if vauxZoneNumber is "7" then set value of variable "vauxZoneName" to "Pool" as text
if vauxZoneNumber is "8" then set value of variable "vauxZoneName" to "MBR" as text
set value of variable "vauxResponseBassTreble" to ((value of variable "vauxZoneName" as string) & " Bass " & (vauxBassSetting as string) & " Treble " & (vauxTrebleSetting as string))
log value of variable "vauxResponseBassTreble" as string
end if
end try
try
if item 2 of myList is "1" then --this is the standard response. Don't log
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
end if
set vauxSourceNumber to item 5 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxSourceNumber
end if
set vauxVolumeLevel to item 6 of myList as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if item 2 of myList is "3" then
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
end if
set vauxSourceNumber to item 5 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxSourceNumber
end if
set vauxVolumeLevel to item 6 of myList --as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if item 2 of myList is "20" then
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
--set vauxSourceNumber to item 4 of myList
log vauxSourceNumber
end if
set vauxVolumeLevel to item 5 of myList --as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if vauxZoneNumber is "0" then set value of variable "vauxZoneName" to "Off " as text
if vauxZoneNumber is "1" then set value of variable "vauxZoneName" to "Kitchen(K)" as text
if vauxZoneNumber is "2" then set value of variable "vauxZoneName" to "Kitchen(F)" as text
if vauxZoneNumber is "3" then set value of variable "vauxZoneName" to "Kitchen(S)" as text
if vauxZoneNumber is "4" then set value of variable "vauxZoneName" to "LivDnRm" as text
if vauxZoneNumber is "5" then set value of variable "vauxZoneName" to "GameRm" as text
if vauxZoneNumber is "6" then set value of variable "vauxZoneName" to "Patio" as text
if vauxZoneNumber is "7" then set value of variable "vauxZoneName" to "Pool" as text
if vauxZoneNumber is "8" then set value of variable "vauxZoneName" to "MBR " as text
if vauxSourceNumber is "0" then set value of variable "vauxSourceName" to "Off " as text
if vauxSourceNumber is "1" then set value of variable "vauxSourceName" to "Tuner" as text
if vauxSourceNumber is "2" then set value of variable "vauxSourceName" to "iTunesPan" as text
if vauxSourceNumber is "3" then set value of variable "vauxSourceName" to "AirPlay" as text
if vauxSourceNumber is "4" then set value of variable "vauxSourceName" to "Cable" as text
--if vauxSourceNumber is "5" then set value of variable "vauxSourceName" to "Cable" as text
if vauxSourceNumber is "8" then set value of variable "vauxSourceName" to "Tone Levels" as text
set value of variable "vauxZoneVolume" to vauxVolumeLevel
set value of variable "vauxResponseCombinedOutput" to ((value of variable "vauxZoneName" as string) & " " & (value of variable "vauxSourceName" as string) & " " & (value of variable "vauxZoneVolume" as string))
--if value of variable "vauxLogging_Enabled" is equal to "true" then
log value of variable "vauxResponseCombinedOutput" as string
--end if
end try
--the short zone name is used on the opening control page to see what's happening at a glance
set vauxShortZone to value of variable "vauxZoneName" as string
set vauxShortZoneName to (characters 1 through 4 of vauxShortZone) as string
set value of variable "vauxResponseOutputShort" to ((characters 1 through 4 of vauxShortZoneName as string) & " " & (characters 1 through 4 of (value of variable "vauxSourceName" as string)) & " " & (value of variable "vauxZoneVolume" as string)) as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log value of variable "vauxResponseOutputShort" as string
end if
if item 2 of myList is "91" then
set value of variable "vauxResponseOutputShort" to "Now Paging"
log "Now Paging"
set value of variable "vauxResponseCombinedOutput" to "Now Paging"
end if
if item 2 of myList is "90" then
set value of variable "vauxResponseOutputShort" to "Paging Stopped"
log "Paging Stopped"
set value of variable "vauxResponseCombinedOutput" to "Paging Stopped"
end if
end tell
end using terms from