app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
And at the end of the script don't forget to turn it back on:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
Hope that helps.
In AppleScript it would be
set user interaction level of script preferences to never interact
I am new to this.
I inserted the line to tell the script to "Never_Interact"
However I still get an error – "Error: open"