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't Save' cls='Button' title='Do&n'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.
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?
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.
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.
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! I’m a beginner; would you mind explaining the rationale behind why it works using “Close Window” activity, but not “Close Application”?