Hi, is there a way to dim screen brightness when it is running on battery and when a certain amount of time has passed?

I have a sony vaio vgn-fs640. I googled but I got nothing. Any help would be nice.