Turning on Wi-Fi on demand Is there a way to reconnect to Wi-Fi whenever an application accesses the network?

Background: I have a rooted e-book reader that runs Android 2.2 (Sony Reader PRS-T1). The system offers an option to automatically enter Wi-Fi standby mode when the connection is idle, which I like: This behavior saves a lot of battery juice when reading an e-book. 

Some of the preinstalled apps know how to reconnect the Wi-Fi whenever they need network access. Unfortunately, conventional Android apps do not know how to do this and fail. For example, I have installed the Kindle for Android app, and it fails to sync reading positions unless I have manually re-enabled the the Wi-Fi before trying to do so.

Is there a method to leave Wi-Fi standby mode and reconnect to Wi-Fi whenever there is demand?
Like everyone seems to be saying I too say that you can do this with Tasker and here's a small tutorial

In your profiles screen, click the + button and select application. 

In the following screen that shows with the list of your installed apps, choose the app that you would wish to turn the WiFi on when opened.

Go back and you will be asked to create a new task. Create one and add the action WiFi and set it to on.

Now go back and long press on the task you created and click 'Add exit task' do the same thing as you did before but instead of setting it as on, set it to off.

So now whenever you open that app, the WiFi is turned on and at other times is off.