If this is FileMaker 13, you can make the button disappear by setting it's Hide Object When property with this expression:
Get ( WIndowMode ) = 1
In all versions, you can modify the script performed by that button to be:
If [ Get ( WIndowMode ) ≠ 1 ]
Put current script steps here
If this button performs a single script step selected in Button Setup, you can create a script for the same script step plus the above If block and change button setup to perform this script.