An automated iTunes? So I've wanted this for a really long time but I'm not 100% sure how to do it. I basically want to be able to have iTunes play a radio station when I come home. 

I was thinking of being able to have a script run every ten seconds or so to see if my iPhone has joined my wireless network, thereby opening iTunes and playing that radio station. After it starts playing, it kills the script from checking again till 12 hours later. (I'm giving an example of 12 hours since I don't want to be at home already and suddenly have music suddenly starting for no reason). 

So where should I start? Am I even starting in the right place? Is there something better than this? I need some help and direction! I feel what I want is relatively simple...  :-/
For a start, you could look at ControlPlane to trigger iTunes when you come home.

from http://www.controlplaneapp.com/about/ :


  ControlPlane allows you to build configuration profiles, contexts in ControlPlane lingo, for your Mac based on where you are or what you are doing.  ControlPlane determines where you are or what you are doing based on a number of available evidence sources and then automatically reconfigures your Mac based on your preferences.  Evidence sources can include your current location, visible WiFi networks, attached USB devices, running applications and more.