Post
#21 and 23 in this thread may help with the Sony. Looks like you need to use a long button press with a mcaro defined on a device select button.
Or, a RCA RCRP05B will learn and have the macro behavior you want. it can probably store up to 30 to 50 learned buttons. But you can also manually assign new functions to button, so that learning generally isn't necessary.