Microsoft Power Automate is a software by Microsoft for the automation of recurring tasks. It is part of the Microsoft Power Platform line of products together with products such as Power Apps and Power BI. More Details https://powerautomate.microsoft.com/en-us/
Desktop flows are the existing robotic process automation (RPA) capabilities in Power Automate and enable to automate of all repetitive desktop processes.
Scripting actions enable you to run blocks of code and implement custom behavior in your desktop flows. All scripting actions follow the basic structure of the respective programming or scripting language: PowerShell, Python, DOS Command, VBScript, and JavaScript.
Execute the Python scripts to declare new variables and return values from Run Python script actions, which use the print function.
Reading this article, you can learn how to Execute the Python scripts using Run Python script actions with the Desktop flow in Microsoft Power Automate.
The following important tools are required for developing Microsoft Power Automate,
- Windows 10/11 (Recommended)
- Power Automate Desktop - Download the Power Automate installer
Now we can discuss step-by-step App development.
Step 1. Open Microsoft Power Automate -> New Flow
Next, Give the Flow name as PADPython, Click the Create button,
After that, we can see the Desktop flow,
Step 2. For Testing, Run Python script action in Scripting actions,
Add the Run Python script action, and Set the Python script to run parameter as
import re
text="Welcome to C# Corner!............"
print text
Click the Save Button
The following variables are produced automatically; for the script's output PythonScriptOutput variable, we enable the ScriptError variable for errors that may occur during the execution of the Python script code.
For Displaying the Python Script Output, Add the Display message action, Set the Message box title Parameter value as "DispOutput", and Message to display Parameter value as
%PythonScriptOutput%
%ScriptError%
and Click the Save Button
Now, Save the PADPython Desktop Flow,
Step 3. Now we can run your PADPython Desktop Flow in Microsoft Power Automate,
The output of the PADPython,
Summary
You have successfully tested the Python Script action in Desktop flow – PADPython in Microsoft Power Automate.