Slider+Volume+Rule and exec binding

Can someone help me, please, fix my rule to set application volume using dimmer item?

item: Dimmer iVolume "iVolume [%.1f %%]"
sitemap: Slider item=iVolume

rule “iVolume"
when
Item iVolume received command
then
val PercentType iVolume = receivedCommand as PercentType
executeCommandLine(”/Users/m/Desktop/i.sh vol" + iTunesVolume.state as PercentType)
end

Thanks.

Any ideas how I can pass dimmer value to exec ?

Either use item or val/var:

rule "iVolume"
when
    Item iVolume received command
then
    if (iVolume.state instanceof PercentType)
        executeCommandLine("/Users/m/Desktop/i.sh vol" + iVolume.state as PercentType)
end

or

rule "iVolume"
when
    Item iVolume received command
then
    if (receivedCommand instanceof PercentType)
        executeCommandLine("/Users/m/Desktop/i.sh vol" + (receivedCommand as PercentType))
end

Maybe DecimalType will work better.
I silently corrected the iTunesVolume.state to iVolume.state :wink:

Thank you! I had to add space after vol "