4.1 KiB
3. How to start
Content
About
The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.
How to use
You can use the robot by the several ways:
- In Python script
- In Studio script (n/a)
Create python script
In order to use robot just add Robot tool folder in work directory and add line “import GUI” in your script.
Example
import sys
sys.path.append(‘../../’)
import selenium [#Web app access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.1.-Theory-&-practice:-Web-app-access-(Chrome,-Firefox,-Opera)
import GUI [#Win32 & UI Automation access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.2.-Theory-&-practice:-Desktop-app-UI-access-(win32-and-UI-automation-dlls)
import pyautogui #Screen capture/recognition #Mouse manipulation
import cv2 #Computer vision
import keyboard #Keyboard manipulation
Execute python script
The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
- Execute in python x32 (OpenRPAResourcesWPy32-3720python-3.7.2)
- Execute in python x64 (OpenRPAResourcesWPy64-3720python-3.7.2.amd64)
- Execute from .cmd file
Execute in the Python x32
To execute your python script in x32 bit version just write in command line from x32 python directory:
cd “OpenRPAResourcesWPy32-3720python-3.7.2”
python.exe “path to your python script.py”
Execute in the Python x64
To execute your python script in x32 bit version just write in command line from x32 python directory:
cd “OpenRPAResourcesWPy64-3720python-3.7.2.amd64”
python.exe “path to your python script.py”
Execute from .cmd file
In order to simplify the execution process you can write several code lines in file with the .cmd extansion:
cd %~dp0 copy /Y ..ResourcesWPy32-3720python-3.7.2python.exe ..ResourcesWPy32-3720python-3.7.2OpenRPAOrchestrator.exe …ResourcesWPy32-3720python-3.7.2OpenRPAOrchestrator.exe orchestratorMain.py pause >nul
Use in studio script (n/a)
import sys
sys.path.append(‘../../’)
import GUI
import keyboard
import subprocess
import time#Highlight the UI Object in Folder explorer
GUI.UIOSelector_FocusHighlight([{“class_name”:”CabinetWClass”,”backend”:”uia”},{“ctrl_index”:2},{“ctrl_index”:0},{“ctrl_index”:2},{“ctrl_index”:0}])#Wait 2 seconds
time.sleep(3)#Loop: get child element of UI List
for lItem in GUI.UIOSelector_Get_UIO([{“class_name”:”CabinetWClass”,”backend”:”uia”},{“ctrl_index”:2},{“ctrl_index”:0},{“ctrl_index”:2},{“ctrl_index”:0}]).children():
print(str(lItem))