Hello,
I've got what you need here :
http://letombe-tech.blogspot.fr/2013/11/openvpn.html
this script does more than change IP. It controls if the VPN is OK (correct IP) or not and then enable/disable downloads with JDownloader, Mipony, Torrents programs !
Sorry it's french language. But I can help translate if you're still interested.