I'm using Mac 10.9.5. When I'm at a Starbucks, my computer will automatically connect to their WiFi network. However, after an hour, they kick you off and although you are still connected to their network, beneath your "WiFi" icon in your Network System preferences, you now have a "Self Assigned IP" and are unable to connect to the Internet. The only way to reconnect is to click the "Turn Wi-Fi Off" button and then click "Turn Wi-Fi On" button to re-enable things.
My question is, how do I write a script to automatically do this for me? What I woudl like is some script run in the background if I'm connected to a network named "Google Starbucks" and then if the script notcied I have a "Self Assigned IP", it woudl turn wi-fi off and turn it back on again without my having to do anything.