Power Automate Desktop (PAD) Best Practices: Part 2 - Speed vs. Accuracy
Michael Annis
Fractional Chief Automation Officer (fCAO) | Digital Transformation Consultant | CPA | Geneva Investor Accounting SME | Private Equity/Hedge Fund Automation |
We all have a necessity for speed. After all, it is one of the reasons we started automation in the first place. However, not all RPA's benefits come from speed. The mere fact that a computer is pulling, manipulating, and rewriting data gives a presence reduces human interaction. The more we can eliminate human error, the more accurate our processes will be.
When creating a flow, we have to think like the computer; understanding its structure. A few extra steps can go a long way to ensuring that a flow works correctly. With that being said, a few extra steps during a flow can save a headache of troubles down the road.
One example of this is pulling a new report from the system to be used later. 90% of my flows are 1) pull the report from the system, 2) open the macro workbook and run the macro to manipulate the report in Excel. Since the macro always references the same exported report file, the reports pulled have the same name and overwrite an existing (old) report in the report folder. Some reports take longer than others. We do not want to create a guessing game on how long the computer needs to wait before running the macro. Too long, we waste more time, and too short, we pull the wrong (old) report into our macro.
In order to solve this, we can delete the old file, and use "Wait for file to be created" to trigger the next step in our flow. That's fine, but what if the old file doesn't exist? We can solve that logic too:
领英推荐
IF (File.Exists File: $'''\\\\C:\\Reports\\JohnCashUG.xlsx''') THE
? ? File.Delete Files: $'''\\\\C:\\Reports\\JohnCashUG.xlsx'''
END
WAIT (File.Created File: $'''\\\\C:\\Reports\\JohnCashUG.xlsx''')?N
A lot of new developers will use "Wait" (in # of seconds) actions to move from action to action or window to window. While "Wait" has it's place, it should always be used as a last resort, or when you know the wait can be set to 1 (second), such as in between "Send Keys." Instead, look for other items you can wait on. "Wait for element" or "Wait for window" can be much more effective to help speed things along while avoiding erring out the flow for trying to take an action to early.
Other actions to avoid include anything with OCR and images. Unfortunately, the OCR functionality, as of the time this is posted, is just too cumbersome. It thinks 1s are ls and vice versa. We can talk more about OCR another time, but most of the time you have to use the multiplier, and the higher the multiplier, the slower it is. Image based actions work phenomenally well if you are on the computer with the monitors that you made them on; otherwise, it will typically result in complete failure. I have the same monitors at both work and home, and 50% of the image based actions still fail, because most remote access programs modify on screen text to help speed up the connection.
In short, do what works for you. In my opinion, UI/Web elements > Send Keys > Images/OCR.
Michael Annis has no affiliation with Microsoft or its subsidiaries.?The “Best Practices” are purely compilations of his opinion and observations of conversations on the Power Automate Desktop User Community; an individual’s use of them should be taken as such.?Michael Annis has been using Robotic Process Automation (RPA) for over 2 years and maintains a “Top Solution Author” position on the Microsoft Power Automate Desktop User Community standings.?The best place for users to get their questions answered is through the User Community located here:?https://powerusers.microsoft.com/t5/Power-Automate-Desktop/bd-p/MPADesktop.