UIPath provides support for Python Script.Python Activity pack will enable you to invoke Python scripts and methods in any workflow directly from studio. You can also pass input arguments to the invoked code, as well as retrieve the output data generated by the activities.
Overview :
Python scope is a container which provides a scope for Python activities and initializes the specified Python environment. When the Python Scope activity ends, all Python objects loaded up to that point are deleted.
First install the python package in the uipath through Manage Packages option provided in the Uipath tool.
There are 4 steps to integrate Python Script
All the python activities are taken place in Python scope.
So after adding python scope, load your python script using load python script API provided in the tool.
Then using Invoke the python method API, call the python method from the script.
Then Using Get Python Object API which is also use inside python scope, converts the output value returned by Invoke Python method into the .NET datatype of your choice.
Sample Script :
This script will displays the current time stamp in the message box and also displays the name provided in the input box.
def hello(name=None):
if name is None:
name = ‘stranger’
print (‘Hello ‘, name)
return ‘Hello ‘ + name
from datetime import datetime
now = datetime.now()
mm = str(now.month)
dd = str(now.day)
yyyy = str(now.year)
hour = str(now.hour)
mi = str(now.minute)
ss = str(now.second)
data = mm + “/” + dd + “/” + yyyy + ” ” + hour + “:” + mi + “:” + ss
import ctypes
ctypes.windll.user32.MessageBoxW(0, str(data), “DATA”, 3)
Output:
Timestamp
This article is in 3 parts in the following parts you will see how to integrate VBScript and Javascript using UIPath
Join our mailing list to receive updates from our team