# How to disable confirmation for overwriting a file?

**URL:** <https://forum.inductiveautomation.com/t/how-to-disable-confirmation-for-overwriting-a-file/28014>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [September 4, 2019, 8:02pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-confirmation-for-overwriting-a-file/28014 "2019-09-04T20:02:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bagrant117](https://avatars.discourse-cdn.com/v4/letter/b/b782af/32.png) [@bagrant117](https://forum.inductiveautomation.com/u/bagrant117)\
**Post date:** [September 4, 2019, 8:02pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-confirmation-for-overwriting-a-file/28014/1 "2019-09-04T20:02:37Z")

</div>

I’m using a momentary button with the following line of code:

system.print.printToImage(event.source.parent, “Screen.jpg”)

And then emailing the saved screenshot out, however a confirmation box opens to ask if the user is sure they want to overwrite the previous file. I want to disable this, and make it so when the button is clicked the image automatically overwrites.

If the user clicks no, an email is sent with the old image instead of updating the the current image. If disabling the confirmation is not possible, is it possible to only allow the email to be sent if a new file is saved?

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [September 4, 2019, 10:26pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-confirmation-for-overwriting-a-file/28014/2 "2019-09-04T22:26:59Z")

</div>

You need to use a combination of [system.print.createImage()](https://docs.inductiveautomation.com/display/DOC80/system.print.createImage) and [system.file.writeFile()](https://docs.inductiveautomation.com/display/DOC80/system.file.writeFile)
