You buy a Harmony remote with their SmartState technology.. It keeps track of how it set things so it can always do what it needs to. (Which works great as long as you don't use any other remote to change the 'state' it knows about.)

The Harmony remotes cost a little more, but have a great WAF, and sure makes things easy.