How to turn on/off ESnaps and Snap mode from scrip file

I'm trying to run some scrips that require the E-Snaps or snap mode to be either turned on or off while running the script 

is there a way to do this?

Thanks

Larry