UI Automation in Power Automate for Desktop (Full Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's learn to automate applications in power automate for desktop the case today is that we want to automate in the windows calculator the windows calculator looked like this go to your start search for calculator or calculator in your own language if you don't have windows in english i have so i just open it here this is the application that we want to automate in we do this because we all have this application installed but also because the same principle applies whether we automate in the calculator are much more advanced systems we will use the same approach now get started so the case today is that we want to open up the calculator then we want to take dynamic input from the user we will store them into variables two variables then we will make an addition of those two variables then we'll scrape the result for example if the user provided two and five we'll click equal and then we will scrape this seven result and present it finally we will close the application so here you'll learn to click buttons in an application you learn to work with scraping results from the application and to present it let's get started so i go to power automate for desktop and then create a new flow i will call this applications and then calc like this and then click create so here's our blank canvas first i want to open up the application so i'll find a run application like this and drag it in here i need to define an application path for the calculator or whatever app i will open today is the calculator so i will just provide it here or find it by selecting file the calculator is a window app so i can just say calc x this one will open up the calculator you can always google the apps that will give you the path so you can easily do it instead of sitting around and finding the executable path on your computer but i click save now let me try to run it we open up a calculator so that's it let's also close it so when we are done we want to close the calculator i will find a terminate terminate process take this one and drag it in so i will terminate it by the process name and then in this drop down i can find some predefined processes i will have the calculator then i can click save so now i will open it and then i will close it nothing happens but this is just to show you how you can open applications and close them again so here i want to have a display message because i just want to pause the flow to see that everything works so this will just be a message box that will pause the workflow and we can click ok and see that everything is going on like we expect to like this so now i can click run so i run the application so this one opens and i even have like three calculators put on pause i can click ok this terminate process will close down all calculated windows beware that if we want to automate in other applications you should have all your work saved of course so we are closing the calculator in the end another good practice is to close down applications in the beginning and then open it because then we know we are on the front page that's it now let's take two inputs from the user and use those to automate our calculator so instead of this display message i'll drag in to display input dialog here i will say number a and i'll say text please put in a number between [Music] 0 zero nine we do this because we only have zero and nine buttons and this could be buttons in any app named something else so now i have the zero to nine and then i will store this into number a variable like this so then i click save similarly i'll do it for number b so i'll just right click and copy ctrl v or ctrl c i could have copied now i have two equal actions so i open up the last one here i'll call this number b instead and store it in the number b variable so these ones will just take on input from the user take a number and then we will use it to type something into the calculator in our application i will delete this display message i will also disable the terminate process because i want to keep it open while while i develop then we can enable it afterwards what you do here is just you right click enable action right click disable action then this step will be ignored so when i click run here i'll run the application and let me drag in this number eight i would say two plus eight nothing will happen but you can see that the number gets stored here now we just need to use this number to type into an eight and of course if the user types in other numbers i want to also make it work with those numbers so now let's find a click action so i'll find a click pick the one that's called click ui element in window and drag it in beneath here this one will be our number a now we will configure the ui element so click the drop down here and add ui element here you can see i can choose all the elements in this calculator i will just pick a random number you can do the same so hover over one of the numbers press ctrl n and click the number we will not use this but now we created the selector then i click save if i want to inspect the ui element click the stack off it looks like papers but it is ui elements here you can see we have the button one first let's rename it you can either press f2 when you're over here or you can right click rename i will say number a button because this one we will make it work whether or not the user has typed in one let's go inspect it you inspect it by double clicking it then this is the address of the number one button we haven't fixed it yet but we'll do so so double click again here you have the address you can have this selected tree or we can fix it manually so untick this custom what's what it says here is that we have a window we have the class windows ui call window the name is calculator and then there are some elements in the calculator and right here you can see that this id number one button so if i instead of number one button could press number five button update close now let's try to run our application once more so now we will press the five instead of one just by changing something in the selector there you go we have clicked number five but let's fix it so make it work that we will type in whatever the user has typed in in number a so click the ui elements double click here double click again and instead of this five delete that click the variables up here and then we will use the number a variable you can see that we have now inserted here we have percentage signs on each part of the number a that means that this is the variable we're using then we click update and we click close now let's try to run it again drag it in from the other screen so i say 4 and i want to add it with four we only fixed the number a button so now it will say four and it will work with whatever button we have in that's it that's four so then we will copy it so i will just do this i will right click copy ctrl v or right click control v what do you think about the quality of this lesson please post it in the comment below that will help me a lot thank you so now i just need to fix the selector for this otherwise it will be the same so what i can do is to go over here i can add ui element then pick a random new number control and then left click that one most bottom nine here we go so first we rename it i rename it to number b button you could also just have dragged in a new click ui element and then made it from here but now you saw how we can do it like this instead like copying the activity so i open it open it again and i click custom off and again we need to go down here to num9 button i delete this and then i use the number b variable so whatever the user typed into the number b that is the second input dialog we will use that here in this selector that's it so i'll click close then i'll go in here and instead of number a i'll switch it to number b this was a little bit more steps than we used to do but now you can see how you can easily toggle between ui elements now we just need a plus and an equal sign so i'll drag in another click ui element between these two i'll add that ui element here i'll pick a plus ctrl and click it so that one was the plus save i like to name it just like the other ones always keep good naming references so instead of button plus i will say plus button so i'll keep the same convention you can see that it changed over here similarly i want to have an equal sign in the end so i'll add that ui element as well here ctrl n and i have the equal sign again then i click save over here you can see that i can rename it and then i can say equal button like this so now let's see if it works and then we just because we don't have terminate process enabled i'll just close it manually so we can see what's actually going on we only have one calculator so now the input dialog is on my other screen i will say eight plus and then we'll say zero for example so now we made it work it will say eight plus zero equals two and that is eight now we want to use this result so we will find an extract here make sure you take the extract data from window and not the extract data from web page sometimes you can get a little bit confused drag it in underneath here so here we will choose another ui element so i will click this drop down i will add ui element and now i want to extract from here so again control n click it this one will be text display is 8. i will store it not in excel sheet but in a variable here we can say see that the data produced that is data from window that is just the name of the variable with the content in here it's a but it could be any result from our calculation so i will rename this i can just say result like this and again because this will work whether or not to displace 8 or so we think we can inspect the ui element again over here first i want to rename it so i right click rename and then i'll save result field like this i double click then i double click once more and then i inspect is there something that where this says result is eight in this selector no that's not so it will probably like it with 99 work whether or not the result is eight that's fine it will just store it into a result variable and let's see that it actually works so now i run it again drag this in i'll say three plus and then just pick two so now just like three plus two equals five and then hopefully we will scrape the result which with result is equal to 5 or display is 5 over here so now you can see we can use this result because this is the exact result that we want to present but wouldn't it be a bit nicer if we could just have the five on and not the display is so let's go fix that as well you'll learn some string manipulation but first let's find a display message to have the message displayed you will use this variable this result variable if you want to write it back into a system into an excel sheet or whatever you want so now we just present it in a message box we drag that in here we will just present the result so here i'll say result is and then in the message to display i'll use the result variable so i'll do this and do this then i click save now i can run it again here i have my input dialog over here so i'll say 7 then i'll say 3 so now i'll say 7 plus 3 that equals 10 and we'll present that in our message box that's it display is 10. now we want to remove the display is if i go over here i'll find a get subtext this one will do string manipulation amongst others activities so i drag it underneath the display message after the extracted data from window the original text that is what whatsoever is in the result variable so i'll click here find the result then i'll say i want to only have the characters after a certain position i want to start at a position and let me see here 1 2 3 4 5 6 7 8 9 10 11 12 so we want to start at the 12th position this is zero indexed so the first position is zero so it's actually position eleven that's just how it is in programming so then we'll say we can have the length is that number of chars or the end of the text i'll just choose the end of the text then we will make it work with whether or not we have one or two digits in i'll store this string manipulation into the result variable again no need no reason to create a new one so i can just click the x here and choose the result then i can click save now i can enable my terminate process again so i right click and enable action let's run the flow and see that everything works you can now create dynamic selectors and you can work with application as this is the same principle that goes so now i do my calculation 3 plus 6 equals to 9. the result is 9 we now got rid of the display is and when i click ok here we will terminate all calculator windows the next lesson is here on the screen just click it
Info
Channel: Anders Jensen
Views: 22,745
Rating: undefined out of 5
Keywords: applications in power automate for desktop, ui automation power automate desktop, anders jensen, power automate for desktop, power automate desktop, power automate ui, power automate ui automation, power automate desktop tutorial, power automate desktop for beginners, microsoft power automate desktop, open application in power automate desktop, ui automation, ui automation in power automate, ui automation in power automate desktop, ui flow power automate
Id: a4qzlWiPcQ8
Channel Id: undefined
Length: 15min 36sec (936 seconds)
Published: Mon May 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.