Can you have two hardware buttons activate the same software button on release?

Example being an on (button 1)-off-on(button 2) toggle switch, with the release of either button 1 or button 2 automatically triggering a button 3. (that isn't available on the actual switch's off position)