# 3. How to use ## Content * [About](#about) * [How to use](#way-to-use) * [Create python script](#create-python-script) * [Execute python script](#execute-python-script) ## 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. ## Way 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. ``` 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](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition) [#Mouse manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)
import cv2 # [Computer vision](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition)
import keyboard #[Keyboard manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-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 "\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 extension: ``` 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)) ```