Check if iTunes is streaming

Sup everyone. I am a newby to applescript. Could someone please help me with this request. I want to write a script that will check to see if the user is sharing their music on the network and to see if they are playing music from internet radio. If they are I want a message to pop up saying something like it’s against company policy, then shut itunes down. What do you guys think, is this possible? Thanks in advance. :smiley:

There are a couple of ways of doing what you want. I’ll take them in order:

check to see if the user is sharing their music on the network

This one is actually a little tricky since there’s nothing in iTunes’ dictionary that will tell you this, however you can rely on the fact that iTunes uses port 3689 for sharing, so you can check if that port is open on your machine:

see if they are playing music from internet radio

This one’s a little easier since iTunes provides a ‘current stream URL’ (and a current stream title) property that you can query:

If they are I want a message to pop up saying something like it’s against company policy, then shut itunes down

This is easy once you have the above two bits set:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]