Convert scripts to dynamic instructions to quickly expand the capabilities of OpenRPA in the toolbox without writing C# or compiling dynamic libraries.
Quick Show
- Add
test.pyscript, then relaunchOpenRPAclient

- Use the script activity instruction

Development Guide
1. Get the script directory
- Get the host from
wsurl. It’sofflinefor offline mode for which thewsurlis empty"".- The host is
localhost, so the working directory (WORK_DIR) is{OpenRPA configuration directory}/script-activities/localhost/
- The host is

2. Create the script
- Create
test.pyin directory{WORK_DIR}/scripts/test/```python
print(f”rpa_args is: {rpa_args}”) rpa_result = f”Hello: {rpa_args}”

### 3. Create or edit the config
- Create `summary.json` in directory `{WORK_DIR}/`
```json
{
"items":[
{
"categoryName": "Test",
"moduleName": "TestModule",
"enable": true,
"scripts":[
{
"enable": true,
"dirName": "test"
}
]
}
]
}

- Create
info.jsonin directory{WORK_DIR}/scripts/test/{ "activities": [ { "language": "python", "name": "test", "displayName": "TestActivity", "fileName": "test.py", "toolboxIcon": "images/test-icon.png", "designerIcon": "images/test-icon2.png", "tooltip": "This is a test script activity" } ] }
4. Use the script activity
- After relaunch the OpenRPA client, the dynamic script activity should appear in the toolbox. Enjoy yourself !

Documentation
Notice: Only test for python
1. rpa_args
Input Argument of the dynamic activity, the recommended input argument types include deep attrs is primitive types(int,float,bool,string), JObject, JArray, IDictionary, IList, etc.
- If the runtime is python,
JObjectorIDictionarywill be converted topython dict,JArrayorIListtopython list
2. rpa_result
Output Argument of the dynamic activity, the recommended output argument include deep attrs types: primitive types(int,float,bool,string), list, dict, etc.
3. summary.json
- Location of the config file:
{OpenRPA configuration directory}/script-activities/{host}/summary.json- OpenRPA
settings.jsonconfiguration may locate in{Windows Documents Dir}/OpenRPA/settings.json
- OpenRPA
- Format of the config file:
{ "items": [ { "categoryName": "CategoryName", "moduleName": "UniqueModuleName", "enable": true, "scripts": [ { "enable": true, "dirName": "test" } ] } ] } - Description of the config:
itemsArray of script instruction modulesitems[].categoryNameThe category name in the OpenRPA toolboxitems[].moduleNameThec#runtime dynamic module name, it has to be uniqueitems[].enableWhether to enable the moduleitems[].scriptsArray of scripts directoryitems[].scripts[].enableWhether to enable the scriptsitems[].scripts[].dirNameThe scripts directory name. eg:test,moduleA/test
4. info.json
- Location of the config file:
{OpenRPA configuration directory}/script-activities/{host}/scripts/{dirName}/info.json - Format of the config file:
{ "activities": [ { "enable": true, "requires": ["selemium==4.10"], "language": "python", "name": "test", "displayName": "测试", "fileName": "test.py", "toolboxIcon": "images/test-icon.png", "designerIcon": "images/test-icon2.png", "tooltip": "这是测试指令" } ] } - Description of the config:
activitiesArray of instruction activitiesactivities[].enableWhether to enable the script activityactivities[].requiresArray of the dependencies for python. (undeveloped)activities[].languageThe script type (python,vb,c#,powershell,AutoHotkey), and only the type ofpythonhas been testedactivities[].nameThec#runtime dynamic activity nameactivities[].displayNameThe displayed name of the dynamic activityactivities[].fileNameThe name of the script file. eg:test.py,subdir/test.py. (The absolute path of the script is:{absolute dir of info.jso}/{fileName})activities[].toolboxIconThe dynamic activity icon in OpenRPA toolboxactivities[].designerIconThe dynamic activity icon in OpenRPA designeractivities[].tooltipThe dynamic activity tooltip message in OpenRPA toolbox
TODO in the future
- process activities[].requires
- validate rpa_args
- show usage of each script activity
optionalload from remote (eg. OpenCore)optionalmanage script activities