iTunes Volume Slider

Hi together,
So, I discovered recently that Apple Script was able to trigger the sound volume specific to iTunes. Thought that this would be super useful if you often play music via AirPlay bla bla, whatever, so I tried to make an Apple Script Slider controlling the iTunes Volume.
My problem is that the little guy gets the sound volume and returns it properly, but he is unable to tell iTunes to set it :confused:
Help is welcome (and kinda wanted :smile:).

if application "iTunes" is running then
   tell application "iTunes"
   	set itunesvolume to sound volume
   end tell
   set currentvolume to itunesvolume / 100
   return currentvolume
else
   return ""
end if

But how do I manage to tell the slider he should also tell iTunes to change the volume?

Thanks a lot for your help, have a great day everybody!

You need to assign a predefined action to the slider (Run Apple Script (async in background))

on bttWidgetSliderMoved(sliderValue)
   tell application "iTunes"
      set the sound volume to sliderValue*100
   end tell
end bttWidgetSliderMoved
1 Like

Got it! Thank you so much!!

1 Like