Trigger a macro when an application's property/state updates?

I use Audirvana Studio for music playback, and I'd like to trigger a certain macro when the playback state changes.

The three possible states are Stopped, Playing and Paused, available in the "player state" property of Audirvana's AppleScript library.

Currently I can determine the playback state like this:

tell application "Audirvana Studio"
ifplayer stateisPlaying then
...
end tell

I'm curious, however, if there is a way for the macro to automatically trigger when the player state changes, rather than the AppleScript above having to check for it. Kind of like a push notification. Is this possible?

Did you check if your app changed the title of a window when the state changes? Some apps do change window titles when certain properties change. If so, you may be able to use the Focused Window Trigger." If not, I think you will have to use polling instead of triggers. I love polling. I don't worry about CPU usage; I can use my CPU for whatever I want, and I just want the job done, so polling is fine by me.

1 Like