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/Sources/GuideSphinx/Robot/03_HowToStart.rst

72 lines
3.5 KiB

####################################
3. How to start
####################################
# Content
- [About](#about)
- [How to use](#how-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.
# 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 <br>
> sys.path.append('../../')<br>
> import selenium [#Web app access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.1.-Theory-&-practice:-Web-app-access-(Chrome,-Firefox,-Opera))<br>
> 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)) <br>
> 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)<br>
> import cv2 [#Computer vision](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition)<br>
> import keyboard [#Keyboard manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)<br>
## 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: <br>
> cd "\OpenRPA\Resources\WPy32-3720\python-3.7.2"<br>
> python.exe "path to your python script.py"<br>
### Execute in the Python x64
To execute your python script in x32 bit version just write in command line from x32 python directory: <br>
> cd "\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64"<br>
> python.exe "path to your python script.py"<br>
### Execute from .cmd file
In order to simplify the execution process you can write several code lines in file with the .cmd extansion: <br>
> 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 <br>
> sys.path.append('../../')<br>
> import GUI<br>
> import keyboard<br>
> import subprocess<br>
> import time<br>
>
> #Highlight the UI Object in Folder explorer<br>
> GUI.UIOSelector_FocusHighlight([{"class_name":"CabinetWClass","backend":"uia"},{"ctrl_index":2},{"ctrl_index":0},{"ctrl_index":2},{"ctrl_index":0}])<br>
>
>#Wait 2 seconds<br>
>time.sleep(3)<br>
>
>#Loop: get child element of UI List<br>
>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():<br>
> &nbsp; &nbsp; &nbsp; &nbsp; print(str(lItem))<br>