I am writing an Applescript for Spotify that is supposed to do two things:
- Log every new song played.
- Every N seconds check what sound device is used.
I do (1) by a simple loop that check how much of the track remains and then use that value in a delay statement in the loop (unnecessary to run the loop at full speed). However, N usually is much lower than the remaining time of the current track. Hence, I would like task (2) to run in a separate loop with N-0.5 as delay value. Basically I want to loops to run simultaneously from the same script. Is this possible?
(Of course I could use two separate scripts but I need to distribute this solution when it is done, therefore less visual complexity - i.e., two scripts running simultaneously taking up space in Dock, needing to be launched etc - is better.)