Microsoft Power Automate Desktop - Beginners Course 2023

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
it's straightforward to learn Microsoft power automate desktop I'm anus Jensen an APA teacher and a Microsoft most valuable professional in our automate I'll make sure you learn everything very easily and with all the best practices tied to it to open up power automate desktop we go to our Windows start menu then we can start type power automate to search for it what I like to do here is to right click and then pin to taskbar then I always have my power automate desktop down here in the taskbar I can even move it so I can move it here where I think it looks now we click to open the power automate desktop this will take us to the front page we will create a new flow and you click up here new flow then we will give our flow a name since this is the first thing we'll build together I will call this our first robot and I'll click create then it will take a few seconds and now we're ready what you see here is the main canvas this is where our code goes and over here to the left we have actions these are predefined code blocks let me show you we can find the system category that is here expand that and then take a run application click it with your mouse and drag it in to this canvas this action will open up an application here we need to give it a path we can either find it the full path by clicking this document over here or simply just use the Windows shortcut calc.exe the other parameters are not mandatory so we will leave them for now I'll click save and now we will click run to run it there you go you have built your first robot it opens up application and this is the application that we will use for the first example it is very good because it has buttons with addresses like real application does it have fields which we can drag data out of and we can open and close it first we want to click an element say number five instead of finding them down here by expanding these categories I can go up to search actions instead and here I want to find a click element in window and I'll drag it in this requires a UI element a UI element is everything you see on your Windows desktop that could be in the desktop itself but also here in applications this means that each one of these buttons is a a UI element so we wanted the five then go click this drop down say add UI element now this UI element wizard shows up and you can see here if I hover my mouse over UI elements it says that here's a button here's a button and blah blah blah we wanted to Target number five so make sure you hover your mouse over number five and it turns red then you'll press control on your keyboard and click number five we have now created a UI element here we will also say that we'll left click this is the most default but if I click this drop down I can choose to right click double click and blah blah blah we will leave it with the left click and then we'll click save we can try to run it again so go up here and click run then it will usually take a few seconds the first timer clicks there you go it clicked number five one other thing that we will also do is to inspect this UI element because we created it and let me just minimize this calculator to find the newly created UIL you go over here to the right it looks like a stack of paper up here to the right here we have it we have the parent that is our computer then we have a window called a calculator and then we'll have the button five double click to open it oh I'll double click this and here we have the element don't worry this code is created by power automate desktop itself it's called a selector and you can just see a selector like an address so here we have a parent called calculator and if I should use it in a real live example think about your own address you have a country minus Denmark and this is exactly what the calculator is that is the country then as we move down the selector for example the number path that could be my city and finally down here in the ID num 5 button that is my actual name that is the actual identifier we can also build the selector up here so here are the trees we can add and remove elements from it for now we will do it manually because that's the most stable solution and you'll learn a lot click the text editor up here now we can edit the selector itself try to go down here to number five delete it and then type 7. now you will click save and we will run our automation once more so the intuition here is now you learn to edit a UI element and you can now change it so it can click buttons now minimize the calculator it's more I will introduce a set variable so go up to actions and then find a set variable and drag it in a variable I'm sure you're familiar with it if you tried coding before if you haven't don't worry a variable is simply just a container that stores a value it's nice because we can easily change the value of this container let me show you this one here you can see the variable that is the variable name and if I click in it you can see that the name is surrounded by percented signs and that is because all variables in power automate desktop is surrounded by percentage signs and here I don't if I want to rename this let's say I want to call it number a I don't need to surround it with percentage sign because what's happened is if I either click with the mouse here or click enter Then if I go back power automate desktop automatically have done it for me because it knows that everything that comes up here is a variable name then we can give it a value so before we use number five and seven now let's just give it number two this means that whenever I call this variable by the name number a it will give out the value too if I click save now let's try to use it in our selector down here so I go over to UI limits and then I'll double click the button five here I want to instead of this seven I can either just mark it or I can delete it first and then we can click select variable here I have my number a to use it I can either click on it and then click select or simply just double click as I prefer it's much faster this means that we now have used number a that variable name in our selector so whatever will give it the value up here that button it will click here I can click save one best practice that I like to show you is that these UI elements we need to rename them perfectly otherwise it will get messy it will not be a problem now we only have three actions but I promise you as your Solutions progresses you really want to get used to this it's very easy just right click rename or press f2 so this is not button five anymore I will call it button okay then click enter and when I clicked enter here the named changed over here let's try run it with a variable now it should click number two when hit start there it is again let us minimize it later on we will of course build a step that will close our applications over here in the flow variables you will see the variables that will get created in the flow and an important thing to remember we if we haven't saved these two numbers right now we cannot use them we can expect inspect them after the flow has ran by simply just going here we can even double click to see that this is a numeric value and the value itself here but if we wanted to use it in some other system or save it to excel we need to do it with the robot runs this is all also what we call the runtime so and we can see we have a number a we created that one up here but we also have an app process idea this is an ID that got created here in the run application let me double click to open it once more down here in the variables produced you can see this app process ID this is clever if we have more apps opened and we want to identify this one since we are not using it another best practice is to disable this variable that got produced so what we do click this Arrow here and now you can see there's a little tip blue tick mark to the left of the app process ID simply just click it here and click save and it disappeared over here always reduce complexity when you develop RPA that is a best practice it will make it easy to maintain in the future both for you your colleague so now we don't want to set variable here to use in the selector we want to let the user be able to select a number that he or she click so I delete the set variable and look what happens now we get an arrow and that is because we try to use a number a variable in the quick UI element in window but it's not initialized you can see it down here and this is an important part that is the errors list that is whenever something happens that's not allowed it will get shown here it even says parameter UI element variable number a doesn't exist it says in line two but we can also see that it's red marked this is line two so we wanted to let the user select this number a instead go up to actions then find a display input dialog don't worry you will learn this name very very fast when I began I thought I'd never learned it but I mean I learned it in like one or two days just by building so build with me I promise you you learned everything drag this display and put dialog up here in the beginning we can give it a title let's just say number a and then we can give a message to the user here I'll say type a number between 0 and 9. what this action does is to take an input from a user and store it in a variable so if I go down here to variables produced and let me click this little arrow again here we have two we have the actual input that will get stored in the user input variable and we have a button pressed variable that will store what action the user took when he or she clicked the button in the input dialog here we will use the user input but let's give it the name number a so we don't have to change our selector we simply just type number a like this we will not use the button press this time so I will untick it due to our best practice that we talked about just before now click save so now I can try to run it again here I'll click run now we will say type a number between 0 and 9. let's type number eight we will click OK it will open and then it will click number eight in a few seconds there you go we'll minimize the calculator again let's go to our U elements this stack of paper again click it instead of adding them one by one in the actual actions we can click add UI element here and now you can see our UIL figure in case you don't have a calculator open simply just go to your Windows start button search for sorry calculator there you go and open it but we already had one open so I don't need it to do that now we can add UI elements more than one let me show you so with controlled in I need a plus so I go down here I have control in and I press the plus you can see it showed up here but this time I'm allowed to choose more buttons so here I want to have the six as well then I want the equal and let's just also pick the minus so remember controlling and clicking now we have four elements up here that is sufficient for now I will click done so we also want the user to be able to type in a second number instead of creating another display input dialog I can just click it press Ctrl C that is like copying everything on your windows then press Ctrl V to paste it in now I have two similar actions but here in the second one I want to create a variable number B so I double click the second action let's give it another title number B down in variables produced let's just say number B click save we will use that one over here and here I took the button six that was the second number I clicked so first let us rename it we can try to press f2 this time or you can also right click and rename so here I will say number B and I'll click enter now we will double click to open it and use the number be in the selector again I want to use the text editor it's safe to say that we can use it down here and we can use a variable over here instead but this solution is not very stable in power automate desktop I always recommend you to open up the text editor and do it yourself you will learn a lot and I promise you this will become piece of cake for you in just a week or two so here we want to instead of this six we want to use the number B exact select variable number B we have now created our second Dynamic selector then we'll click save now we can do our calculation so I go up here and then I find a click UI element in window so the the robot has typed in number a now I want a plus and now we don't have to create it because look if I just click this drop down I have my UI elements here I can of course create a new one but we wanted the plus so I just double click the plus here that will select the UI element of the plus sign I'll click save I also want to click number B so I drag in another click UI element in window click the drop down double click to number B click save we also warned n equal so I drag in another click view element and choose the button equals double click it save so now my flow takes in two numbers from the user open up an application and do some application work let's try to run it so here let's just say number four click OK say number six click OK if your pop-ups doesn't show up sometimes it will be in the background you just need to find it or on your other screen so now we are saying four plus six equals it equals tens and we want to scrape this result but let me go back here one other best practice is to remove the unused UI elements again go to UI elements because now we created a minus we are not going to use it we can of course click these three dots and delete it but a great way to do it is to go up here three dots remove unused UI elements it will ask us for confirmation I'll say delete and there you go it can remove multiple unused UI elements it's very smart now I go up to my actions and then I'll find and extract data from window it's very important that you choose this one and not extract data from web page so pick that one grab it in here here I need to find a window to get my data from and this was my last calculator don't worry we will close all these and we'll do it with the robot later on here I want to grab this 10. so what I do here is to click this drop down add UI element and this is the narrowest field I can get to 10. maybe I get a little bit too much data with me we'll see just press Ctrl click it and we have it we can store it in an Excel spreadsheet or just click this one here a variable now let's go up here and instead of data from window I will call this result again another best practice rename your variables so they will say something meaningful about the content that will make it a lot easier for you and your colleagues to maintain in the future now I click save then we'll also go to UI limits again and again you could find it by clicking this UI elements up here because it says text display is 10. I want because this is the result Grabber so I want to first right click rename and then I can say something like display result like this or something like input field whatever you prefer just have a standard and now let me just click enter and let me double click to show you the selector of that yes here you can see that there's nothing in it that says display is 10. you can see it here if I chose to include this name here up here from the selected tree name display is 10. that will work each time the result was seven a ten but for now we will need to do a lot of calculations so this will not be nice to include and that's why power to make desktop didn't include it for us then we can click save so now we've fixed it over here I also want to it's not really cool to have all these calculators on I can use a terminate process this will terminate all calculators that I have opened so each time I open a new it will get terminated in the end that is another best practice always clean up after your robot don't leave 10 applications open I'll choose the process name click this drop down and then I'll go down and find the calculator app it's here and I'll click save let's try to run it to see everything works and this data extraction this will get stored in a variable so let me just click run first here I'll say four I'll say seven this will type in four plus seven and then it should store the result in the result variable there you go now you can see that first of all our all our calculators shut down fine you can also see that we got the result but here we have a display is in front of our actual result and I can double click to open it let's say that we wanted to use this to type into some other system this will not be nice because the other system won't use this text in fact it will might give us narrow so what I will do here is to get the subtext I'll only have the 11 because I know that in front of each one of the results we will have a display is and a little space and this will be character the first character is always zero one one two three four five six seven eight nine ten eleven so we will need to get the character at 11. this will work with any result that we will get like close so here I want to have a get subtext and you drag it in just below here the original text that is a bit that is the result that we got up here we stored the result in a result variable and now the clever part comes just click this little X here that will open up the variable picker click the result double click it that's it here I will choose a character position we just found that we always know that this display is with a space is all weighs 12 characters or number 11 and I want to say at what length do I want do I want a numbered length that could be 1 2 or whatever no I just want to go to the end of text and here I can store it in a subtext variable I will just overwrite the result variable because this is what I'm going to use so I go in here and I can start typing or I can click this x here double click the result I have now the result then I can click save let's also create a log where we store something in it we will do it in a notepad and the easiest thing is to minimize your flow here right click anywhere on your desktop say new text document and we will just call it log text we will only use it to grab the path of this so I'll shift right click and then I go down here obvious path now I can delete it I will not use it anymore then I'll go back to power to make desktop another best practice is to use a variable to store file path because they can change this will probably not stay on my desktop forever it will move away so what you will do is go up to actions and then go find a set variable and drag it in here I will call this one file off and I'll go down here Ctrl V paste it in then I'll delete the quotation marks like this power automate desktop will not use it then I'll click save now I can use this path to write and store a lock so I go up here in actions and then I'll find a right text to file and drag it down here file path we just got that so click this little X here and double click the file path then we will choose some text to write it could just be your robot ran on and then in hard brackets this is just because we haven't found today's time yet I'll just say today's date time this is something that we'll need to get but for now we'll just use this hard-coded value so we will know that we need to fix this with result then you'll say colon and a space now we will use the result that we get out from first this extract data from window then we have made it prettier down here in the get subtext and to do so again click this little X over here whenever you see X you can use a variable like this x double click the result that's it we will append a new line we will not overwrite existing content because we will use this log to store each one of the results from this robot so now I will say append content click save let's try to run our robot twice to see that it works so I'll click run and here just pick in some random numbers I will say three and five I'll make it run you'll see that it will click the elements and then it will shut it down you will not see these steps but it will do them in the background let's run it one more time seven plus zero and then we will inspect the log here let me minimize it once more open up the lock and let me drag it in from my other screen there you go we now have a lock it's just I mean it's limited because we haven't added today's time yet but we will do so now let us close the lock back to power to make desktop now to get the current date and time when the robot runs we go up to actions and then you'll find a get current date and time drag it in right after the set variable I always recommend to have these variables that can change in the beginning then it's very easy to come back and fix it say that this path will change I'll need to have my log somewhere else this is the get current date and time is a function and we'll use a lot we will not change the parameters it will just get us the current date and time from our system time zone we will store it in a current date time variable and I can click save since this is a date time variable I'll need to convert it to a text so I can use it down here in my lock now go to actions and then find a convert date time to text here it is drag it in after Step 2 that is to get current date and time here I'll choose a variable that I should convert and that is exactly the Q and date and time so click the X double click the Q and date time format to use here we can choose a standard format then I can click this drop down here choose the general time long time this is just the format that we'll use here you can easily pick one of the other formats if you prefer that one for your lock now we can see that we have this variables produced called formatted date time we can click save go down to your right text to file double click it and instead of this one here we just hard coded this one in we will delete it then we will click the X here double-click the formatted date time we will now use the date time in our lock click save now go run the robot again to see that everything works here I'll say number five plus eight we will let the robot run and then we will inspect the lock once more so 5 plus 8 equals 13 our robot run go down to your lock there you go we have now included date time a luck close to lock again and go back to Power automate desktop now let's try to run the robot again I'll try to produce an arrow say I type in a letter here that will be number B and that will of course not exist on my calculator so I can just type in number three here now my robot will try to type in or find the UI element with it says num B button it can of course not find it and there you go we have an arrow this also means that our robot will stop here so we will not write a log that says that this number couldn't be used it will just stop our robot not very nice we always want to lock these kind of Errors I know it's a simple example but in a real life scenario we want to track this and we definitely want our robot not be a not going to stop in because of an arrow so let me just close this one again again we will use a label down here that means that if an arrow happens up here number a and number B we will use a label that our robot should continue with go up to actions and find a label drag it in down here just before the right text to file and this label I'll just call log I'll click save so now this label is a label that I can tell my robot to go to just to go to the lock now go up to button number a so double click here click on Arrow continue flow run and then here in the exception handling mode then I'll choose to go to label click the lock one other thing that I would like to do is to store an error message in my result variable so click new rule set variable go over here to the new VAR we will not call the new bar of course we will use the result double click that and here I can say something like couldn't click number a then we'll click save we will do the exact same thing for number B so double click it then you'll choose on Arrow choose continue flow run here go to label and we will choose the log label this is an important part of RPA development that is how you handled your errors so be sure you pick this up and I'll go up here to new rule I'll say set variable choose the result again and here I'll say couldn't click number B then we'll click save if an arrow happens now in one of these two then we will move to the log we will write the log but that means that we will not have the calculator app closed whenever we faced an arrow so what we can do here is to grab this terminate process and then grid drag it all the way to the end in that way we will have our calculator closed whenever there's an error at the robot let's try to run it again and let's produce an error and see that we can write a log and our robot will continue so let us just do this now it will try to click I put in a letter this will fail so now it should go to writing the text to file and terminate the process that looks good but let's inspect a log as well so I double click here there you go you have now created a robot that can handle errors and you can lock your errors as well so let's close the lock go back to Power automate desktop now we are done with our first project remember to save it because we don't have an auto save here in power to make desktop but power to make desktop will ask you whenever you try to quit it if you want to save it now I can close it up here and let us open up this one again for some reason it created two one of these the one of them will disappear when we restart the client we can if I'm unhome I can go to my flow stereo it disappeared we can see our create flows here in my flows and we will create a new flow now you and I will build a real live project together it will teach you everything about web scraping Excel and a lot of advanced based practices including working with selectors scripting and a lot more like new hello we can give it a name I will call this one web scraping to Excel and then I'll click create and again it will take a few seconds and now we're ready this time we want to open up browser so go up to actions and then find launch here you can choose between four browser types I don't have any preferences as long as you don't pick Internet Explorer I'll go with chrome in this example but if you prefer Firefox short Edge feel free to go with it that's the same thing here I can see I will launch a new instance that is fine then I need a URL and now we will use an example page this will be sports apparel but it could be any Cloud web page that you have data in this is just great because we all have access to it we don't need a login or something like that so just type in HTTPS colon and it's only one colon sorry and then www globaljdsports.com we will choose to maximize it the window it doesn't really matter but it will be nice when I'm running this and I'm going to explain you what's happening on the website so I'll choose maximized then I can click save with this single action when I click run it will open up a web page with JD Sports now we want to do a search up here in this search field so I go back to Power automate desktop here let me just close this one again I'll find a populate text field on web page drag it in so the web browser instance that is browser we created that instance up here then we will need to create a UI element click this drop down add UI element now we need the browser to be open so to do so I'll find it here and here you can see that these browser elements they turn red just like the calculator I want to type something in here so again I press Ctrl and I need to have it read Ctrl click it we created a UI element then we can say what do we want to populate into that text field well I'll say Nike t-shirt that's fine I'll click save so now when I run this this will open up a web page and then you can see here we typed in Nike t-shirt the problem now is that we need to click either search or an INT to make sure that we do the actual search but that is just minor things I go back here again we have a little weird UI element name so shouldn't we fix that one first go over to UI elements instead of input text queue I will rename this to something better this could just be I can say field search like this and then it got nicer over here so I can easily see what we're actually trying to do so we either want to click search or to send an enter click we can try to send an enter click so find sent keys drag in the send keys I want to send an into click and that one you can find in insert special keys misc and go find and enter click which is here you could of course also have written it I just prefer to do it like this then I can click save now let's try to run it once more so now it will say Nike t-shirt it will make an enter click in a few seconds there you go we have now done a quite Advanced solution but we also want to grab this these results this could be any search result in a structured format that we want to do so let's do some web scraping it's done with a single action in power automate desktop if I go back here then I go up to actions find and extract data from web page and drag it in here what I need to do again we look in the browser instance I need to open up a search result page which is here then this little y live web helper opens it works a little bit different than the other helpers but it's almost the same so here I can select what I want to grab it's very important that you pick the first element and that is this one here here I want to get the title out and that is this angle so what I can do here is right click in case you don't see this white menu in case you just see a normal browser right click menu what you need to do is to click cancel over here in the live web helper click cancel once more in the action and then reload the browser try once more this will work so extract element value and now I will get the text from this title so as you can see Power automate desktop puts green dots around it and it shows up over here now we want to indicate a pattern so we go to the second one and here we will pick it it's very important you can see here I can either pick the anchor or span that I prefer the most narrow selection but the important thing here is that if you clicked anchor over here you also need to do a anchor here I'll do this there you go how to make desktop automatically says well this is a pattern I will grab all titles from below you can see them over here now we want to do similar things with I want the URL to each one of these and I also want the price so the URL is tied to the title so I go to the first one again then I right click extract element value and then if I go down to the age ref I can see in fact the start of the UL like here there you go we now automatically cut the URLs for all the elements over here we also wanted the prices and here you can see these ones are divided in several elements and this one is on sale but if I go down here you can see that we have only one price here so what I will do is to choose the entire element that is this diff because then I can with the same selection I can get this div and this diff out instead of just having to create multiple selections so pick the entire div then ex right click extract element value and pick the price here now we have this discounted price here and then we have all the other prices down there we will fix it with some Advanced select selected gymnastics later on for now click finish here we will scroll a little bit down we can store our data we can store it into a variable that is fine and then we can say we want to store it in a variable at what name do we want to store it in let's just call it this result again but because that's what it is I click save now you can try to run it and this time we should be able to store all the search results from this search page in a variable with that variable it would be very very easy to be able to write it to for example and Excel sheet so if I go back to my power automate and if we inspect the results by double clicking over here here you can see all the scrape results but look what happened it looks like we're missing value tree that were the prices however we are not let me just show you this could be a mistake like we you usually do that when we for some reason power to make desktop sometimes have these bugs here in this variable sure but what I can do here to inspect that I actually got the result out is to find a display message drag in the display message and then we simply just write out this result this is by the way in a variable type of a data table with rows and columns click this x here and then choose the result click save We Run The automation once more and then we will just inspect the results so like t-shirt and there you go so this is just a message box that pops upstairs and here you can see that we have the actual prices in the data table it looks a little bit weird to structure and here we can have the sale prices and down here we have the normal ones we will fix that but now we can see that they are present and don't worry about that again we have quite many of these browser windows open because we ran it a few times delete the display message again this was just to inspect that we got to write data so let's write the results out to excel so we can verify it close all these things that we have opened right a few ones so here I'll create a folder on my desktop I'll right click new folder I'll call this project usually when I develop I will have this project folder on my desktop it's easily accessible and then when I move it into production I will simply just move the folder there or I will change the path in the power automate desktop or both what I will do now I'll grab the path to this folder so shift right click copy as path again shift right click to get the path of this folder then we go back now we will use a variable for the project path set variable just as we did with our log so drag in a set variable up here we will call this one project path and then the value control V to paste it in again delete the quotation marks so that means that when I remove this project folder say I have some input data for the robot in it then I will just change it up here and not several times in the robot this reduces the risk of Arrow so now we have the project path variable now we will save the results to excel let's first launch an Excel instance so find a launch Excel drag it in right after the launch new Chrome here we can choose to launch with a blank document that is fine because we are going to write to this Excel worksheet we are not going to open up a previous created Excel sheet make instance visible usually that's nice when we create our first robot we can see the robot works but it hurts performance a bit and it's not necessary here again we can see that variables produced Excel instance this created an Excel instance then we can click save now we want to so we created this one here then we want to after we extracted data we want to add a new worksheet with the results too so I go up here and then I'll say add new worksheet drag it in here after the extract we can give it a name let's just call it Nike t-shirt since that's what's that's what we're getting so Nike t-shirt we can choose to add the worksheet as either the first or the last sheet doesn't really matter we will just add it to as the first one here then we can click save so now we have added this one here then we need to write the results back to excel so I'll find right to Excel worksheet and drag that one in here what do I want to write I want to write the result data table click this x here check the result so where do I want to write it I want to write it in the column A that's where I will start my data table I'll pick the Row 2 because I will have headers in the first row so for now I just click save whenever I create a new Excel instance a sheet1 will be created you probably know that we don't really need that and this just looks a little bit ugly for our solution so I'll find a delete Excel worksheet and drag this one in here here I'll just say delete worksheet name sheet1 I'll click save finally you might think that you have saved this to excel but you haven't you've opened up opened up the Excel instance and then start writing to it we need to close and save this is a common mistake too I see it often because sometimes because one drive you might have OneDrive on your computer that syncs with your Excel C2 maybe some of them will get written and you think oh well how automate desktop is not working it is we just need a close Excel so go up here drag in a close Excel so here we can see um Excel instance do not save document we will so we'll say save document as and we will provide a document path like this x we have our project path we know that but we can also make a subfolder and then we can write the results in there so how that looks will be results and then we will have our name of our Excel book so I can just say results dot xlsx so this will be a subfolder called results and our Excel book will be namedresults.xlsx what is important here when I click save is that we go to our project folder double click to open it and it's over here here we need to have the sub folder so I right click new older that is my project folder and I'll just need to create that otherwise our robot will give an error you can of course create the folder with the robot if you Advanced or not really Advanced you can do it with the actions but for now this is fine let's try to run it and see that we're able to save the results and maybe we can clean a little bit up we don't really need all these windows open so and of course we are able to close down the browser windows like we did with the calculator but let's first let's fix one problem at a time that's how we solve it here with our automate desktop so now let us assume that we are done here oh I go in here we can see that we are done let's see if we have saved the results go to your project go into results here we have it open up the Excel book I open up on the other screen here there you go we now have our data and now we have the prices yeah we have some scrape data here or maybe that's just an Excel bug it was so here we have the title we have the URL and we have the prices I know this this format looks a little bit weird we will fix it don't worry one step at a time close it go back to Power automate desktop when this robot runs over and over it will override the log that we got out here that's that's the result dot xlsx so let's use the date time again but we will this time we will use it to create a dynamic file name this is not a good practice to learn go up to actions then you'll find a get current date and time here drag it in right after the set variable again we like to have these things that we use in our flow these variable settings in the beginning so I can easily come back to the project and change yeah I will just get the current date and time system time zone and I'll save it to q and take time I'll click save that's also that's what I wanted to get two seconds before let's have a convert date time to text drag this one in again you can't do nothing wrong just trying to do these things yourself so today if when we are building if you see something that you like to add to the robot just try it you will not break anything I promise you so here the date time to convert that will be the current date time like the sex during daytime this time we will use the custom format because now we will need to write a date time that we can use in our file naming here I will use the.net custom date time format and that looks like this you might know it from Excel and if you want a Google to know more you can google.net custom date time format that is a nice guide then I'll say days hours minutes seconds we will use this one here now we will get a date time down to the seconds we will use that in this file name so the results won't get overwritten here we saved in the formatted date time I'll click save here Now open up the Excel in the document path right before the results dot xlsx we will use the form at a date time so click this X format date time maybe we should have an underscore in between here so it looks a little bit nicer like this we can click save let's try to run our robot with Dynamic file naming now we shouldn't overwrite any existing data that we have previously recorded so now we are scraping and again um we can't really see it usually this robot will just run on the server so it won't make any difference but here we can see that we're done let's just close it there you go we now have a different file and I can open it that's just the same results but now we are not overriding our results each time we're running the robot let's also add headers to this Excel sheet I'm going to go back here right before this right to Excel worksheet let's have another write to Excel worksheet drag this one in yeah so here we need to have the Excel instance once more and then we will just add in the row for the headers this needs to be done in a data row format and you can actually see this data table as a collection of data rows so here we just add in one more data row to this collection in fact we don't do it but you can see it as such here we add a row and right after we add a collection of rows so that's the way to see it the way to write it is to have two percented signs then move inside here then you want a curly bracket in the end and start and in the end like this and in here you want a hard bracket start hard bracket end and again I can make some just to so you can see what's going on this is how it looks then inside here in single brackets and that is always texts here I can just write products that could be the First Column name then I will have a comma these ones are column separated then I'll have the URL like this a comma and I'll have the price and don't worry you can just when you click save automate desktop will tell you if there's an error in your typing and here I'll have now we will not use it now but we'll use it a little bit later in this lesson so let's just add them now so we don't have to do it later so these ones looks great we will write it in a specified cell these ones will go into column A and now it will be Row one this is only one row I can click save if it gives you an arrow here you have not written what I did here you just need to carefully write it one to one let's try to run it once more again as a power automate desktop developer and an APA developer in general we usually run these robots multiple times when you develop develop to see that each step is carried out correctly now let me go back to my power to my desktop we're done go down here and this should be the third one or was it this one here there you go we now have the headers products UL price now was we don't have any data here but the intuition is that later on we want the was price here we want a now price here so let's save it again now let me go back to one of the search results if I scroll down here you can see that we have multiple Pages we will we want to be able to scrape each page and the intuition here is that we want to look for this next page if it's present click it it also means that when I go down here if I'm on the last page that's not page four let me go down again it's grayed out we cannot click it but we need to make some sort of logic into power to make desktop first thing I would like to do is to show you how the code behind this next button looks let me go to page one in the first one here then I will let me copy this URL open up a new browser and paste it in here so now we just have two new a new tab but with the same search result I'll go to the last page on this tab that's it now I want to inspect this one and on the first page I want to inspect this one this can be done by simply right clicking say inspect this will give you the code of this site and here you can see as I move my mouse over here in elements this will give me the code of each element and this is the code that power to make desktop uses so it is a nice thing to do to to know and here you can see that in the a element there's something called title next page and that is when a next page is available but if I go over here let me inspect that one instead then let me move down here and here you can see that um I have this span Class A Button B BTN default disabled page enough so in here I don't have this title equals next page so I can use that I can look for an element containing this title next page this attribute called title next page in the a element shouldn't we create that in power automate desktop let's do so go back here first I want a loop condition in a loop condition will continue as long as a condition is true so go look for a loop condition and then we'll need to talk about where do we want the look Loop to be we want to surround it with this extract data from web page so drag the loop condition right before the extract data from web page that is here this Loop will just run forever until we say it shouldn't run so just type in true in percentage sign this means that this condition will always be true then we can click save I want to drag in the extract data from web page and in here I also want to check for the next button so this Loop will extract this web page as long as there is it will click the next Button as long as there is the next button and then extract the next page now we will find a if web page contains like this drag it in in the loop condition we will have it here and here I'll ask if this contains the element and that will be the next button click the drop down add UI element go find the next button it will be here press Ctrl and pick it if you haven't had the next button up simply just find it in the browser then we can click save and now I realized that well I want to scrape first and then I want to check for next button before I um exit so I can just simply just take this extract data from web page and move it in front of this if I realized that I did a certain mistake now I want to inspect the UI element of this next button so go up to this one here and here you can see it got created it got created as an anger search Nike double click to open it and here you can see this looks very weird and this will only click a button with the ID search from 72 and of course this will not work on the next like this one here it worked here but it will not work here since let me just show you what this means I will have this one here have it here and this one says from two one six so what we need to do is to create it ourself and this is very easy we just need an a element and then we want the title equal next page and sometimes it's a little bit of experimenting it might be today as well but we will go up to the text editor and then we had this a and then we had a title equals two so let me just oh let me have the hard bracket instead of typing it we can just go to the browser again you can type it if you want and go over here double click copy Ctrl C go back to power to my desktop paste it in there you go this is our selector for the next button I will click save so if this um so the intuition here we scrape the first page then if we have a next button we want to click it and then we will run the loop once more else we want to um exit the loop let's first fix this awful name so I go over here right click rename and this is the button I will call this button next like this so now it looks a little bit better here I want so this one is only when this is true we want to click it I also want to find an else and that is whenever this is not true when there's no next button present we will need to exit this Loop so here I'll find an else bracket in let's fix the exit part first because that is easy I'll just find an exit Loop drag in the exit Loop here then I want to click on the next button if that's present and that means that we click it then we move down here we will not perform deals part then we move down here the loop will run once more then we will extract the data then we will click and exit that present that will happen each time we have a next page button and then we will exit so um here you will find a click link on web page rack this one in and you can have it anywhere you want I will just wait not anywhere we want you can drag it in inside this if so here I will choose the UI element we already created that that was the button next that is the one we want to click if I just double click here then I can click save now we should be able to looping through each page and clicking the next button let me just delete one of some of these we will of course terminate the Chrome in the end let me just save it just for the sake of my computer going down you should make it a habit just to do so here and there we are saving let's try to run it and what we want to see here what we like to see here we do the search and then we should be able to click each next page it will of course extract it then we should be able to click the next button in a little while there you go now you can see up in the URL bar you can see this is it says from now we are scrolling and then this might be the the last page page four then our robot should end without an arrow let's see if I go back here it did and what happened here is that we now created this solution so we want to scrape the data and unfortunately there's no way to join these data tables as we scrape them we scrape one data table here then the loop will override it over and over there's no direct way to join this but we can make a very nice workaround which is what we will do so what we'll do here is that when we do this search and we assume that this search result exists later on we will see how we aim our handle then we want to do one extraction so what we can do here is that I can control x copy it out and cut it out place my mouse on this Loop condition Ctrl v i just placed it out here so it will extract one time here and then it will go in here and if the next button exists it will click it and then we will have another extract data from web page we do this so we can join these two it's always it's also a nice exercise to see how to join two data tables so I'll go in here and I'll just I have this in my clipboard so I'll just mark this else Ctrl V now I have it in here I will give it two different names so this one is result that is the base one and then we will have the just data from web page whenever we scraped new pages then we can easily merge it so double click and down here in the variables produced we can call it data from page we do this again to we can easily join the results so we have a base one here and then we have the data from web page so what we will do here is that we need to we take each row in this data from web page and add them to the result so it looks like this find a loop and this is a very very Advanced but a bit of advanced logic I don't expect you to fully understand this the first time just do it with me you will learn so much and you can easily do it yourself just pick in a loop this time a loop will go from a start that could be one two five and then with increments of one we will change this slightly this Loop will run five times so this Loop will start from index 0. that is because a data table is zero index that means that when we call the first row it is index zero so we say index 0 then we want to end at whatever we have the number of rows that we have in this data from a page -1 again because it's your indexed so find this little X here take the data from web page and then you take the rows count double click here we need to subtract one from it so go in here and then say minus one the variable is produced that will be Loop Index this will keep track of where we are in this Loop so I'll click save now I want to set a variable I will need to add things to this result and it's very easy so have a set variable drag it in here move it up here take the result that is where we want to add to then I want to add each row in this data from web page and since I'm looping the room here I can just use this one here so I want to say I want to have whatever is in the result already and then I want to say I want to add a row from data from my page find it here in DX again and now you need to remove the percentage sign here we only need to have percentage sign in the start and in the end then I need the data from my page and then I want to say in hard brackets I want what index what row number I need to add to the result and we have that stored up here as the loop index so here I just find the loop index again I use this variable picker so I don't make mistakes now I will do this and I'll click save so what we will do now is that we will add all the new results to the result and then we will write it out so now we will have all our results in the Excel sheet let's just click save again one thing that we can do to speed a little bit up is to have this run delay to one if we run our flows from out here this will be default but it in the debug that is the developer version it adds these delays so let's just have this by one and here I made a breakpoint these ones here are breakpoints when you click a line and it turns red simply just unclick it otherwise your robot will stop there now we try to run it once more and we will do the search and then we will scrape the different pages it will take a little bit longer here and we will see that this will work here now it's page two then it will be page 3 page 4 and we should have our results this was our page four and we should be done here then we can go back to Power automate desktop now you will see that in the results we have 208 228 rows so now we got all the results from each one of these Pages let's also see that well we have a lot of windows open let's also open this one here inspect our results so now we not only have the first page if I scroll down we have all the results here and if I scroll up again it's still with the headers of course so then I can click close we also want to do a little bit of error handling let's say that the item doesn't exist that could be that we have a diff search item that were not in the inventory let's just type in onassis.org let's try to run the robot and here I want is to be able to let my robot continue whenever it gets narrow here there's nothing to scrape so our robot will look for this collection it will realize that it doesn't exist and then we will have the arrow so if I go back here you can see that it can find this data so again we will create a label let me close this I'll scroll down to the end because if Amazon org if that's not a valid item in my inventory or this webpage I want to move to the very end and let us just have a label like this and first I will just have the label here and here I will call this the table end scraping and then I'll click save then I will go up in the first extract data from web page double click to open it on a row I'll go into the continue flow run in this drop down I'll go to label I'll go to inscribing this is when an error is produced here similarly I will double click the second one on Arrow continue flow run go to label and here I'll say in scraping I'll click save now let's try to run it once more now we should be able to handle the error this will just go to the end when it realizes that this doesn't exist and um it will say well we cannot find it on this page it's narrow so we just move to the end there you go our robot continued and we have no errors anymore now we want to be able to do multiple searches based on an Excel input for now we just had the Nike t-shirt the anesians and org so what I will do here is to create some input data go to the project folder again and go to the root of it so this is our project and within that we have the results right click say new and we'll create a new Excel worksheet I'll call this one products like this let's double click to open it here we go so I want to rename the sheets to products so I right click I'll say products like this and then I go up here and make the headers and this one will be product here and then I'll have the Nike t now I am a t-shirt like this and just do it as I do then we'll have the Asics Gel we'll also have the Adidas shorts then we'll have the anesians.org just to see that our robot can handle arrows and finally we'll have the converse so these are the ones we make we'll have four things that we will think will succeed in one Arrow so that's it I can just make sure I save it and then I can close it now I know that this products is in my folder here I go back here so what I will do before the launch new Chrome I will have another launched Excel this one will read my input data so drag it in here here I will not have a blank document I will open the following document which document do I want to open click the section take the project path then I want to then I know is in the root so I just make it backwards last and then I can say products.xl SX that's the one we just created we will not have it visible yeah we can choose to have it read openness read only that's nice because we are not going to write anything back it will give us a little bit more performance it's not a lot finally the variables produced Excel instance 2 that's not really nice so I go down here and rename it I will just call it Excel instance products like this and then I can click save then I will read from this Excel instance so I'll find a read from Excel worksheet then I'll drag it in here I will read from the Excel instant call Excel instant products now it's nice that I named it probably here I want to say not the value of a second cell I want the all available values from worksheet go into advanced because we also had headers in our sheet I know it's only one column but we had headers in so mark it here then the variables produced is called Excel data go in here and say Excel data products and then click save so what's happening here is that we read the products we launch the Excel instance with the book we read it and then we'll also need to close it now just do a close and then you'll find a close Excel and you will drag that one in here here we will close the Excel instance products and we will not save it by the way we can since we only open it as read only we can click save then let's try to do a breakpoint and test our automation because as I told you we can just make breakpoints try to click here this at this place the robot will stop because now when I try to run this you will see that we only perform the actions until the breakpoint and then our robot pauses but that means that I can go over here to the Excel data products I can double click and I can inspect the data that I wanted this looks nice this is exactly what I want I can click close here and then since I'm not really interested in the rest of the robot robot I know that this works I can just click stop so now I know that I have five products to run through and those ones are the five products in the Excel data products for each of those products I want to do a search I want to click return I want to extract the data I want to write to excel I want to do all these things so let's find a forage a for each iterate to a collection and here our collection is this data table so find your forage and then you will drag it in right after the launch Excel and before the probably text field and web page here I will say each value to iterate that will be my Excel data products double click here the current item this is just a reference name we can name it exactly like we want so if I go in here and then I can just say shouldn't product like this I can click save we haven't got a lot in it but we will have this click this public text field then go all the way down to label and scraping we will not move the closed Excel so what you can do now is to press Ctrl and click untick the close Excel so now we marked everything we wanted in the for each click the control X that will cut out everything now click on the end that's important click here Ctrl V that will paste in all the actions and we move this breakpoint up here we just need to fix a thing or two so for each one of these we will not search foreign but we will search whatever is in the Excel data products that is the one we call Q and product so double click this and here I will find my current product over here and then I will have the header I know we only have hit one header in that data table so I'll say hard bracket single quotation mark and then also a product that was my header and then I'll have a hard bracket let us copy this one we're going to use it again let me just give you some time to actually write it right click save so this is our search let's scroll a little bit down down to the add new worksheet here we want to dynamically add the new worksheets I call mine q and product product again that is the worksheet that we want to add and write the results too one thing that we'll also need to do is that here we delete this sheet1 but we can only delete it once it only got created at initialization so we simply just move it down here now we can start the robot and see that it works so um we will initialize it and then you will see that we Loop through each one of the products some of the products we only have one page on this Nike t-shirt we have four pages on but it should work on each product that we have including the errors in the arrows we just wanted to be able to go to the next product later on we will write a little log so now we have the Nike T-shirts then we will have the next search item I think there's only one page that was the Asics Gel and then we will move on in case you want to network and solve RPA problems with more than 5 000 RPA developers then you should join my Discord you can click the link in the up right corner here we each day solve real-time problems and network around our careers I think Converse was the last one we have two pages and we should be done sometimes it can be a little bit difficult to see whenever we're done but let's go try it so here again I can scroll down and you can see that we are on page two that was fine then we go back to Power domain everything looks fine here and then the very nice part is that if I go to results moving here then as you see here we have all the results created from each one of these products so now we can do multiple scrapings in the same Excel book so now I will show you an advanced concept but a very important concept and that is select the work close this one here what I want to do is to let me show let me be sure that I have a page open that could be this Converse that we had this last time then I go back here let us open up the first result here that is the extract data from web page that's the first one the second one was in here so double click to open it here I will open up a search page I need that to make this web helper open then I will go into advanced settings here you can see the base selector that is the address for the first element in our structured data so that will be this one here the LI that will be the first li element and further down below we have a selector for each one of these ones the first one was the title then we had the URL and we had the price and these ones are created in a CSS format so this one was the price and this took everything we saw that it took the discounts that now was but it also took these base prices let me scroll down to find a Discord discount here you can see it so what I will do here is to go into this price Mark everything Ctrl a control C copy it out go to Windows find a notepad it's always nice to have a little notepad when I develop here I'll say base price and then I'll control V I'll paste in the selector of the base price this is uh quite nice because now we can save it I can also save it for upcoming projects so I always recommend do so when you work with these selectors save it for the next time save it in your development folder now we are done here so let me just close this for now and I will also cancel this so it looks it makes it a little bit nicer to look at let me just refresh here so what I want to show you because I told you that this was the base price and let me just go up here I can right click and inspect it I can also press F12 on my keyboard that will also open up the developer tools again you can you should only have this if it has something weird going on and or if it has it over here in to the right then you should tuck it to the button it's designed for that so these three dots click them log into the button then you'll be sure to be in elements now go up to the first element then you'll click this Arrow here and we will inspect this one here let's just click the title so we had this Li element that we saw that it says span span diff e q e o the zero and that was inside the first li element and if I just do let me do this you can see all the different Li elements that was the base selector those ones are stored here and the base selector gave us the address of this l i element that is the first one and then this one says in the LI element that was our price find the span take a span and then take the first div equals to zero what happens here is that Weeble this is our span this is our span and then this is the diff you can see that there's two diffs but this is the diff if I expand this there's our price that is how power to make desktop price and we can use that and similarly let me just show you for the discounts so I scroll a little bit down click the arrow we will just do it here and similarly you can find it inside the first li element and here it is it looks a little bit uh different but it is in the was or in it is in the now price so we have two different categories here that is the two span elements let's do it one by one there's no magic here it's very important that you do this this will um give a very nice addition to your Microsoft power to my desk desktop Playbook so here again here I will say price now let's create a selector for that we will use it in power automate desktop in a little while so what can we do here and maybe we should do this and then we can just take the price and then we can have the actual now price let's start with that so this is the now price if I click here we can find it in here so again I know I'm in this I have the span span div that was the base selector of the price but right now we can see that in this one here and this this that was the reason it grabbed everything from in here and see here that the diff that got both the was and the price I I'm only interesting in the now and the now price should be in here so what we will do here is that we'll say find the span element with the attribute class equals pry then move inside the span with the class equals now and let's get with the span element with the attribute data or a price and here we will have the own text so that looks ER like this so the first one that is the span class Prime and we can just do this so I'll say span then a hard bracket class equal and then we will have the prime that is the first part of our selector then we'll say what comes next and that is the span class now so and we can do this there is this element with the attribute class equal now like this and now I just need to make sure very sure that we do this this is why it's sometimes better just to copy paste but since I'm writing uh teaching you here it's a little bit more easy to do it like this and then I will have it span and then I will say what does it says that data oi price and this is just an empty attribute so there's no value to it but we can use it so we'll just say equals to into quotation marks so this is our selector and here we will combine it with the base price this was the this was that gave us up here and this so if I just do this Ctrl C then I'll go in here Ctrl V and then I'll do this this is the selector for the price now similarly we will add the selector for the price was so here I'll say price wasp and again now I can just do the base price first I know I need to do that and then I'll say what do I want here well now I want to let me close this now I want the voice and then I want the data or a price so um here I'll say span class equal to was and then I want to say now go look in the span data oil price I already have it up here so I'll just copy it so this will give me the was price then I also need to do a little bit work because I will this base price only got me the actual this one got me all the prices I want to be able to have a price original so here I'll say price I'll read you know that is when there's no sale so I'll do this and I know I need to have this base price first and then let's inspect a original price so what we will do here is to do this then we'll move in here and here we can see that we have just in inside here we have a a span and here we have the date oil price we also have a class equals price so let's include both of them to make it stable there's also to teach you a little bit about the selectors I know this can seem a little bit hard but you will get very used to it this is an important skill when you want to work as a power automate developer whether you're a citizen developer or professional developer so this one was the first class equals Prime you see it here and then we also want the data or a price and what we will do here is to simply just say we know have another attribute that was called Data oi price equals like this it's important to say that if we are typing something wrong here and it will not work now we have the selectors for now was an original then we can go back to Power automate desktop open up the X extract data from web page so we'll just take the first one here then we'll need some search results sometimes you just need to move the window a little bit away because now we need to scrape three different columns we already made it ready when we created the headers for our sheet but we'll go into advanced settings and here it's very very nice I want the original I want that here let me just clear it so we'll make it and then I want um the now and then I want the was so I separate them into three different columns and just to do this so we can have it here so I want the original up here and that was this one here we created so just do this and up here you will type own text then we will have the now so here we create the selectors ourselves we still did the first item so and that one is fine and then we will have the wasp like this so now we have created them ourselves I'll click OK here here you can see our price that one works fine in the first one let's scroll a little bit down to see here us we now have separated them into different columns let's run and inspect so I click finish here I'll click save here and one important part is that we'll also need to do it in data from web page so open that one as well and then we can um try to run again here we should have it just do the exact same thing so make two select this delete this one here we will have own text in each one of them so I can just do this boom text and now we will have the selectors in each one of these three make sure you pick them in the right order so the original the now and there was like this and here you can see it again we have the sale layout and we can click finish so now we have set that up I will like to save it and then we can run the automation so now we're doing the exact same thing as before let me fast forward this that's it let's go back to power to my desktop it ran successfully again and and again save this notepad and let me just inspect the results to see that I have what I want there you have it we now have if it's a normal price we have it here otherwise we have it as a now and a was and we have that for each one of our results now let us try to get rid of this little pound sign so we can use the amount in calculations close this one here and then I go back sometimes when the predefined power automate desktop actions is not enough we can use scripting we can choose between Python and JavaScript but my preferred one is VB script because how will it works with the Microsoft applications let's see how we can get rid of the pound signs and here you will go to the course page so I created this course page for you here you'll find the VB script it's by the way also fill in the resource resources that could be the Discord which I can recommend you to sign up you're also welcome to connect with me LinkedIn and please send me a message if you like this course I'll be so happy and furthermore I have an always updated Excel sheet with the best power automate desktop resources so these are my three go-to resources which I recommend you to click on and use anyway here is our simple VB script it's just a VB script that initializes Excel it opens up an Excel file and here we need to put in our path and then we will Loop true each one each sheet in the Excel book then we will get the you see the range that we are going to use that is the range which have data in then we will Loop through each one of the rows the cells and we will replace a pound with nothing then we will save close and create we will do it outside of our power automate desktop flow or when we have ended it that's a practice I recommend so we will not interfere with what's going on there and usually power to make desktop and Excel doesn't go well and then or rather we need to handle it accordingly so here I'll just copy the script you can do that up here in the right corner or you can mark it now we have the script then go to Power automate desktop so we will do it right at the end here you will find a run VB script here we'll drag it in you don't need to understand vbscript you just need to understand how to use it so here I paste it in that is my script the valve was produced let me do this the output that is if we take some output out of this script we don't so we can untick it the script arrow that is whenever this script we made an error in the script or our data is not there for some reason then it will lock to a variable we will not use the variable for now because I know this script will work I created it and tested it but when we develop I recommend that you turn this on and here you can see that I have my Excel book path this will not work because this will just be a hard-coded path it will not work but if I just go up here I know that I just used it I just have this path that I want to format that is right here so the easiest thing would be to save double click this close Excel copy it from here Ctrl C and then use it in your PB script so sure you do this and now we have it then click save and let's try to run it again and now our result should be nicely formatted without the pound sign so again I will Fast Forward till the automation is done that's it let's go to Power automate desktop oh it still runs so here you can see our VB script is running and it doesn't really matter we will just wait that's it and if you had an error in your script it will show down here it will say something that you should inspect but for now this is fine we can see it then we will open this one here Bingo we now have gotten rid of these pound signs we did it for all the sheets this is not so much this script is not so much to show you or how to get rid of pound signs but it is to show you that it's very easy to use code use code in workflows now let's create a log in the end so I click save we'll find a set variable so here I'll have a set variable and I'll drag it in let's talk about the structure of our luck I can start by calling it lock and here we will write it this will not be we will not have everything nicely formatted into startup but we will use this format so I'll say your robot ran on and then we will have a date I don't have the date a nicely formatted yet so I'll just use this this is a placeholder and I'll go down here I'll say Eros this will count my arrows so here I'll have an error count then I'll have this successful this will be the success count like this I'll have which one of the Search terms were arrows if any here I'll have the error names success I'm so bad in writing English sometimes when I code and it's been a long day so um and yeah if you have any questions about power automate desktop or this tutorial please give them to me in the comments below I will gladly engage with you so now we have this one here I also want to tell in the lock which input we used that will be the path to input data this is just a structure of it this will of course all these values will not work I can do this this is just to have placeholders for everything then I can easily fix it one by one the output and then I'll have the path to Output data and here this should of course be data as well let's have them one by one the output I still think it's in my clipboard let's go try it so if I just do this that was so this will write out the output um Excel book then I want the input data so here I'll click save which data did we use we used this one up here in the launch Excel so double click it copy it and then go back to our lock so we fix them one by one here it is and the success count that is each time we have a successful item so we create a calendar let me click save here let me go up here and that is add the result here I'll have a set variable and here I will call this success count that's each time our robot will get here then we'll just say success count plus one and we will make um um addition to this success count by saying plus one and here we can find it as just because we just created it so the lazy developer will have to write it and we'll do this otherwise I could have saved and moved into it but this is how we add one to the success count one by one so we do it by here so now we have a success count I can go back to the lock and we will use it here go over to this little X and now we can find it here and here I also want an error count let me click save here I know that each time this one fails this extract data from web page then we will have an arrow so let me double click to open it go into the on Arrow here I'll make a new rule so here I'll also be setting a variable give it the name error count and similar to before I will say Arrow count plus one and remember represented sign then we can click save now we will use that in the log as well so here we now have an error count as well there it was then for the successful names I'll click save here in the beginning we'll create a new list and here we will add the names to it the list is just a variable type that will store items of the same type we can do it in a set variable but we also have an action for that so here create new list yeah we can call this list something this will be the success names like this I'll I'll save it like this then I know again right after this extract data from my page where we had this success count we will also add an item to the list so here we will say add item to list drag it in right here and what what list do I want to add to that would be the success names so let's go find the success names then I want to add an item that will be the name of that search that is the current product product so here you go find the current product then in hard bracket single quotation marks we will say product like this and a hard bracket end there you go now we can use that list down here in the robot successful at the Rope at the log of the robot is successful so here successful names we will do almost similar with the error names now I will just introduce a subflow so here I click save then we go up here we will also add a list for the arrows so create new list and this was not a create new list this was an add item to list so let's go find it that's just the way it goes when sometimes things goes a little bit fast right create new list and here I want to say error names and I'll click save so the intuition here is that I will create a subflow and each time we have an arrow here we want to run that subflow so let's create a subflow by having this drop down a new subflow and here I will call this error names list and click save the intuition about the subflow is that if we call it from the main then we will perform it and then we'll move back to the main just um after that and here I'll just add an item to the list again so I'll do this into what list that will be the error names this one here and up here I will have the Q and product product again like this and we can click save now we just need to call it from the actual Main where do I want to call it I want to call it inside this extract data from web page when an arrow happens so double click an arrow and here we will create a new rule so we have this error count but we'll also have a new rule run subflow and that will be the error names list click save now we can use that arrows names list in the log as well oh we are getting there so the arrow names list that's this one here one thing that we'll need to do is that we can remove this base from after this and this list this is because the list creates a double space another space after them so to in order to make our lock look nice we will do like this now we can make our date we can use the date that we used for the file but that's not really really nice so what I will do is save then go up to or where we have this to get current date and time and convert date time to text so here I will find a convert date time to text find it here and drag it in the date time to convert that is still the current date and time I'll just need to make it a little bit nicer to look at still use the standard and here I'll use the full date time long time it will looks like this the variable is produced is called format date time let's call it formatted date time or log I will click save move down to the actual here and up here I will have the variable of the date so here I'll have the formal date time for log I will click save now we can use that lock for example write it to our project folder or we can send an email why don't we do both so let's start by finding a right text to file here and drag it in after the log so the file path well I have the project path here and where should we keep it we can add a log folder for our project here so if I go here I can have a dock look like this then we can move back inside our what my desktop is here so here I'll have the project path I'll have the lock and then I'll have the file name here I want to use the date once more so I don't override anything so here I'll have the formatted date time I'll just have this I'll say log dot txt it will just be a notepad file so what text do I want to write well I just have my log variable it's here I'll not append a new line that's fine overwrite existing content well it's not really we know that this one is quite unique so I can just click save here let's also see how if we wanted to send an email with the result what that would look like so first I will find a launch Outlook find it here again so this one will just launch a new outdoor instance that's fine then I will have a send email message to Outlook and here these arrows will come and go just ignore him it's unfortunately what we have to deal with sometimes but um and we'll have to make it down here so the account that I want to use that is your data account mine is my email it looks like this who do I want to send this log to I don't want to spam anyone so let's just send it to myself like this and here I can have a subject a lock for your robot that ran and again this one is you can of course make it a lot nicer you can do a lot of things to it so let's just do it very simple we're gonna have to lock we can even add the attachments or anything that we wanted here but we want to do it very very simple we just created our log and we'll click save then we can choose to close our web browser finally and we'll have a close web browser and we can have that here or actually after up here but I prefer to sometimes have all the close ones at the same time you can have it here at the close Excel here we will close the browser instance that's fine I'll click save so now we build our very Advanced flows with arrow handling scripting multiple searches web scraping logging everything you can think of let's try to kick it off and see that the last added part Works especially the logging I will lean back fast forward the video and then we will inspect it that's it let's try to inspect the results first I will open up the email that our robot sent me here it is that is our nice log your robot ran on and then uh this uh entire log that we created together let's also inspect the actual lock it's in here to open it it of course looks the same because it's the same variable reduced now you want to network and practice power automate desktop do it at my Discord it's completely free we have more than 5 000 developers here's how to join
Info
Channel: Anders Jensen
Views: 35,876
Rating: undefined out of 5
Keywords: power automate desktop, power automate desktop tutorial, anders jensen, power automate desktop tutorial for beginners, microsoft power automate desktop for beginners, microsoft power automate desktop, power automate desktop 2023, microsoft power automate desktop 2023, learn power automate desktop, power automate desktop for beginners, power automate desktop anders jensen, how to learn power automate desktop, RPA, robotic process automation microsoft, rpa microsoft
Id: qfpHqfp2R3Y
Channel Id: undefined
Length: 112min 4sec (6724 seconds)
Published: Tue Jan 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.