[SOLVED]Airfoil - Setting a variable to the current volume

Posted on
Fri Jan 15, 2016 8:17 am
bosstdh offline
Posts: 12
Joined: Jan 10, 2016

[SOLVED]Airfoil - Setting a variable to the current volume

Hello all,

I am having difficulty with applescript.

I am trying to set a new variable VolumeMasterBedroom with the current volume variable of an airfoil speaker
once i do this i want to multiply it by a factor and round to whole number

this is what i have so far

Code: Select all
tell application "IndigoServer"
   set value of variable "VolumeMasterBedroom" to volume of variable "Master_Bedroom"
end tell

please help

Posted on
Fri Jan 15, 2016 10:46 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Airfoil - Setting a variable to the current volume

Try this:

Code: Select all
tell application "IndigoServer"
   set value of variable "VolumeMasterBedroom" to value of variable "Master_Bedroom"
end tell


Note, you had "volume of variable" rather than "value of variable" on the second variable reference.

[MODERATOR NOTE] moved to the AppleScript forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 15, 2016 1:53 pm
bosstdh offline
Posts: 12
Joined: Jan 10, 2016

Re: [SOLVED]Airfoil - Setting a variable to the current volu

Hi Jay,

Thanks for your response, what i want to do is get the current AIRFOIL VOLUME value of the Master Bedroom speaker and assign it to a variable in Indigo called VolumeMasterBedroom. I then want to multiply the result by 10 so that i can implement a volume bar on my control page using up and down arrows and have the volume visually change see attached concept. The reason to multiply is the Airfoil volume goes from .01 (lowest sound) to 1.0 (loudest). I have the various volume buttons already named Volume+.png, Volume+10.png to Volume+100.png etc

Thats why i needed the applescript code.

Is there another way to do this then adding a variable with different images to represent the volume?

I also want to add what the max volume should be as i have blown speakers with my old Control4 setup due to not having volume feedback, with this control page overtime the speaker is turned on i have a script that set the volume to very low and then the idea is to set a limit the volume can not exceed last time it cost me $2500 to fix my speakers my pushing my touchscreen lol.
Attachments
volume.png
volume.png (19.05 KiB) Viewed 1271 times
screenshot.png
screenshot.png (213.84 KiB) Viewed 1271 times

Posted on
Fri Jan 15, 2016 2:19 pm
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [SOLVED]Airfoil - Setting a variable to the current volu

Ah - well, that's different. This should work:

Code: Select all
# First, you need to get the raw volume value from the Airfoil application:
tell application "Airfoil"
   set rawVolume to volume of speaker "Master_Bedroom"
end tell

# then you multiply that by 100, convert to an integer, and insert it into the Indigo variable
set value of variable "VolumeMasterBedroom" to (rawVolume * 100) as integer


You want to multiply by 100, not 10, since you want the scale to be 0-100. This script works as an embedded script. If you want to run it outside of Indigo, then wrap the set value of variable line with the tell to IndigoServer.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests