How to use image exists with a popup menu?

I want to do the following.

  1. Open a notepad
  2. Type some text which can be an empty string or a string with letters
  3. Close the app.

The issue is that when I close the app the popup menu (save, don’t save and cancel) can either appear or not. I want to check whether it’s appeared and if so save the file and if the opposite then to close the app.

The problem is that when the popup menu appears nothing happens unless I manually close it.

I use Image Exists activity and set a Boolean variable as the output.
How can I fix it?

I would personally use the “Element Exist” activity to handle the PopUp, and the rest is pretty much the same you are showing there, except where you use the write lines you can use activities to handle said popup.
For example in the “True” branch, you can use a Click to close the popup thus, closing the application. In the “False” branch, there is no need for any other activity as the application is closed.

@ELLISAG Thank you, I’ll try it tomorrow.
I tried to use the “Element Exists” activity but I didn’t use any activities to handle the popup. I just wanted to make sure the activity works fine, making those “Write Line” things to see it in the log. And I was very surprised that it didn’t work the way I wanted as the popup menu interrupted.

No, unfortunately, what you suggested doesn’t work. It simply performs no actions when the popup is active. Even if I record a click on “save” on the popup menu, it doesn’t work, with no any “if” or “flow decision” things being put in the flowchart. Just “Close application” → “Click”. Still nothing.

Try to use selector below inside element exists activity and check
wnd app=‘notepad.exe’ cls=‘#32770’ title=‘Notepad’
wnd aaname=‘Notepad’ cls=‘DirectUIHWND’
ctrl name=‘Notepad’ role=‘pane’
ctrl name=‘Do you want to save changes to Untitled?’ role=‘text’ /

Please note that , there should have something written inside your notepad file before click on Close or Save Button.

@vikrammahit it says I put it with incorrect syntax. Every line I put inside < /> environment but I can’t get why it’s incorrect

Corrected it to:

<wnd app='notepad.exe' cls='#32770' title='Notepad' />
<wnd aaname='Notepad' cls='DirectUIHWND' />
<ctrl name='Notepad' role='pane' />
<ctrl name='Do you want to save changes to Untitled?' role='text' />

Also my apps are in Russian so I guess I have to replace Notepad and stuff with the Russian equivalents

All the same things. The app runs, when the close activity performed, it’s like stuck on the popup menu. The app then is waiting for 30sec, then stops. The log information comes only after the app is closed, although it should appear right after the element exists activity is performed

can you please share xaml file

@vikrammahit Sure, here it is

Main.xaml (14.8 KB)


Main123.xaml (16.8 KB)

Manange your selectors accordingly

@vikrammahit Sadly but I forgot to test the way with the “Click” activity to close the app. I didn’t even need to change my selectors, it worked automatically. Strange thing honestly. Thank you a lot.

Why doesn’t it work with the “Close Application” activity? Just wonder