dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X
http://www.controlplaneapp.com
BSD 3-Clause "New" or "Revised" License
1.76k stars 180 forks source link

Start audio (onPlay?) #399

Closed rooi closed 9 years ago

rooi commented 9 years ago

Hi,

Great application! I've created a rule/action that turns off my receiver when the mac starts to sleep. I would like to turn on my receiver when there is an audio output, or if certain application start playing. Is there a method to do this already or should this be a feature request?

Thanks!

Roy

dustinrue commented 9 years ago

There is nothing that detects audio output but there is a running application evidence source. Could fire a script when an app starts that turns on the receiver.

rooi commented 9 years ago

Thanks @dustinrue,

I cannot get it to work as I would like using the method you mentioned and will try the shell script evidence source or add some code to achieve this.

rooi commented 9 years ago

Hi @dustinrue,

I cannot find any examples on how to use scripts for evidence sources. You documentation seems clear, but it does not seems to work. I'm using the following script to detect if iTunes is playing:

tell application "iTunes" if player state is playing then

display alert ("iTunes is playing")

    return 0 #success
else
    #display alert ("iTunes is not playing")
    return 1 #failure
end if

end tell

Is this the way it should be used?

Thanks!

Roy

rooi commented 9 years ago

Issued a pull request that should fix this issue