You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Wiki/04.2.-Tool-Robot.-How-to-us...

3.4 KiB

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
import GUI #Win32 & UI Automation access
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 (\OpenRPA\Resources\WPy32-3720\python-3.7.2)
  • Execute in python x64 (\OpenRPA\Resources\WPy64-3720\python-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 "\OpenRPA\Resources\WPy32-3720\python-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 "\OpenRPA\Resources\WPy64-3720\python-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 ..\Resources\WPy32-3720\python-3.7.2\python.exe ..\Resources\WPy32-3720\python-3.7.2\OpenRPAOrchestrator.exe ...\Resources\WPy32-3720\python-3.7.2\OpenRPAOrchestrator.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))