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.
image

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.

Regards.

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.

1 Like

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:

2 Likes

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?

1 Like

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)

3 Likes

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.

4 Likes

you should use close window not close application

3 Likes

I haven’t ripped apart the activity for Close Application, but it appears to be force closing the Application process, which would explain why your Click activity selector on the “Don’t Save” is no longer valid, once the workflow continues, it eventually times out.

i was also facing this issue by using close window, It works fine.

so i had the same issue and did this:

  1. replaced activity “close application” with “close window”
  2. under “close window” i selected “click” from mouse activity, then selected “save” from the pop up.

worked perfectly for me.

Hello, I have created a sequence project for this issue. the sequence i follow after it has written into Notepad was:

  1. Close Window
  2. Click Button and selected “Save”
  3. Type into Text - used it for writing into filename field
  4. Click Button and selected Save.

This has saved my notepad file. Hope this will help

@suzaloop :-

Select Close Window Activity > select notepad
then popup will comes up save, don’t save or cancel
Select Click Image Activity > select Save button image from pop-up
Now select Type Into > select the File Name Bar and enter text of your file
Now select Click image activity > select save button image, it works fine

This fixed my problem as well! :raised_hands:t5: I’m a beginner; would you mind explaining the rationale behind why it works using “Close Window” activity, but not “Close Application”?