Dealing with "do you want to save" popup dialog


A simple case of closing notepad after writing in it. A standard ‘Do you want to save’ dialog pops up.
How to handle this dialog? This question is about dealing with this kind of sudden prompt, not really that much about writing into a file.

I’ve tried WaitUIElementAppear activity followed by Click-activity but the process ends up in an timeout.
I’ve tried setting a selector for the Click-activity:
<wnd app='notepad.exe' cls='#32770' title='Notepad' /><wnd aaname='Notepad' cls='DirectUIHWND' /><wnd aaname='Don&apos;t Save' cls='Button' title='Do&amp;n&apos;t Save' />
but this ends up in timeout also.

How to click ‘Don’t save’ in this popup dialog? Any already existing thread that answer’s this question?
[edit1: tried to clarify the question more]


Well if you use “Write Text File” instead, then you don’t need to open Notepad or worry about it.

If that’s not an option, then I would suggest opening UiExplorer and make sure you have a valid selector then copy/paste the selector over to your Click Activity. But, you will probably need to go through the Save dialogues as well since it wasn’t a previously saved file.

Quick Solution: Just use Write Text File to output your text.



My workaround here for the tutorial I was doing was just to empty the field after writing the text so no save prompt would be shown.

But that is just a workaround. My question is about dealing with a prompt like this that for some reason isn’t included in the original ‘attach window’ activity.


I am having the same issue! Let me know if you figured it out please!


Can we add a click event on save button and then automate further or is there any inbuilt plugin which can help with this ?


I’m not sure i understand the problem
Why not just click it with a click activity?
Bellow workflow works fine for me:


So that workflow is what I’m doing, and it’s not clicking on ‘Don’t Save’ I’ve tried a variety of ways, and the click Button refuses to correctly select the right UIElement.
Was there any resolution to why this works for some people but not the user who posted or myself?


It’s really hard to do troubleshooting on another mashine :slight_smile:

You could try the workflow that I’m using. Maybe your workflow have a diffrent setting somewhere?
testNotepad.xaml (9.3 KB)


So this is strange. I saw you used Close Window to exit out of notepad. I was using close application. When I used Close Window, the click worked fine. Our clicks were identical, it just seemed to be due to the way I closed the app. Thanks for sending me your xaml.