Having WIFI on drains your battery faster, that is correct. The easiest solution is probably to get a new battery or to leave the laptop plugged in to the charger. Alternatively, you could just shut down the computer when you're not using it.
As to your question about a script, I think you could use
to shut down your network interfaces and start them again when you need them. Note that this is taken from memory, so it might not be entirely correct, as I haven't used ubuntu for some years.