How to handle "Overwrite?" prompt properly?

Hi experts,

I struggle a little with writing robot scripts properly. I can throw something together, but I don’t know if I’m using the drivers and waits correctly. Unfortunately, the Academy doesn’t provide much help with the conditions, or I fail to understand it.

I am trying to write a simple, but robust handling of the “overwrite” prompt of any application, say, Notepad.

My logic would be:

  1. Robot sets text of the FileName textbox
  2. Robot clicks on Save
    Now either the ‘Save as’ dialog disappears and file is saved…
    or a ‘Do you want to overwrite?’ dialog appears and the robot needs to confirm

How would you write this in accordance with best practices?

Many thanks!


Hi Marek,

You can put the actions to confirm overwriting the file in the Exception Handling block.
If the bot doesn’t find the “Confirm Save As” window, it will skip the actions and go along with the script.

Another way to implement it would be to use “Wait for image” and wait for the image of the Confirm Save As window to appear, and if it does - click Yes or press Enter.
But the first way is more reliable.

Hi Alesia,

That would work well in the Recorder, but how to write something similar using the drivers in a bot task?

Thank you!

The code will be as follows:

try {

switchToExistingWindow("[TITLE:Confirm Save As]", 10000)

inDesktop {


} catch (Exception i0)