In the layers panel properties for the layer, manually set the visibility to "visible when on" and set printing to "Never", then turn the state on or off with your script:

__
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
__
David Dagley, CFP®
Developer at
www.PDFAutomationStation.com
__
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___
___