Hide and unhide grid,& XYZ Axes in one shortcut

 From:  Elang
11736.1 
Hello everyone!

For illustration purposes, I often need to hide all the grid lines and XYZ axes before taking screenshots — and then show them again afterward.
Is it possible to automate this with a script and assign it to a single shortcut? If so, what would the script look like?

Thank you very much in advance!

– Elang