I think it would help if you draw a diagram of what you want to do and post a photo of the drawing. See this Simple Image Guide
It is too easy to misunderstand a verbal description.
One solution might be to build upon the comment at the end of Reply #3 and create a patch cable that can plug into the Arduino's power socket and on the patch cable but two similar sockets - one for the battery and one for the power from the mains-adapter. Arrange things so that when you plug the mains adapter into its socket the power from the battery is cut off.
Something like this

...R