From 52fb23bc1d9b6b5c71f23d1a0a86586d2ef25b39 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Wed, 8 Jun 2022 15:14:44 +0300 Subject: [PATCH] Wiki rus in progress --- Robot/Python_x64.cmd | 3 + .../GuideSphinx/03_Copyrights_Contacts.rst | 73 +++--- .../Orchestrator/01_Orchestrator.rst | 27 +-- Sources/GuideSphinx/Robot/02_uidesktop.rst | 4 + Sources/GuideSphinx/Robot/04_keyboard.rst | 222 ++++++++++++++++-- Sources/GuideSphinx/Tools/02_Defs.rst | 11 +- Sources/GuideSphinx/conf.py | 4 +- Sources/GuideSphinx/index.rst | 18 +- .../Orchestrator/Managers/ControlPanel.py | 1 + .../Orchestrator/Managers/Process.py | 2 + .../Orchestrator/__Orchestrator__.py | 7 +- Sources/pyOpenRPA/Robot/Keyboard.py | 205 +++++++++++++++- changelog.md | 2 + 13 files changed, 491 insertions(+), 88 deletions(-) create mode 100644 Robot/Python_x64.cmd diff --git a/Robot/Python_x64.cmd b/Robot/Python_x64.cmd new file mode 100644 index 00000000..4cb25535 --- /dev/null +++ b/Robot/Python_x64.cmd @@ -0,0 +1,3 @@ +cd %~dp0\..\Sources +.\..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe +pause >nul \ No newline at end of file diff --git a/Sources/GuideSphinx/03_Copyrights_Contacts.rst b/Sources/GuideSphinx/03_Copyrights_Contacts.rst index 7540ce47..34fee7ec 100644 --- a/Sources/GuideSphinx/03_Copyrights_Contacts.rst +++ b/Sources/GuideSphinx/03_Copyrights_Contacts.rst @@ -1,22 +1,34 @@ .. _3.-Copyrights-&-Contacts: #################################### -2. Права & Контакты +2. Лицензия & Контакты #################################### -pyOpenRPA is created by Ivan Maslov (Russia). -Hosted by PYOPENRPA LLC (Russia) +************************************************** +Лицензия +************************************************** + +Лицензия pyOpenRPA разрешает бесплатное использование только для некоммерческих организаций и физических лиц (не ИП и не самозанятый). В остальных случаях требуется получение цифрового сертификата от правообладателя (ООО "ОПЕН РПА"). + +Получить, проверить сертификат, а также ознакомиться с текстом лицензионного соглашения Вы можете по адресу: +https://pyopenrpa.ru/verification + +pyOpenRPA не использует какие-либо инструменты физической блокировки функциональности своего ПО. +По всем вопросам Вы можете обратиться к правообладателю, контакты см. по адресу: +https://pyopenrpa.ru/Index/pyOpenRPA_product_service.pdf +Используя ПО pyOpenRPA Вы осознаете свою ответственность в случаях нарушения лицензионного законодательства и совершения неправомерных действий. -My purpose is to create #IT4Business models in the companies. -I can help you to create the new #IT4Business in your company. -#IT4Business homepage - https://www.facebook.com/RU.IT4Business -#IT4Busines is the methodology which is created for build compact fast and reliable IT function in company. -If you has many IT specialists, very long deadlines for the IT tasks, many bugs in IT software - #IT4Business is for you :) +ВНИМАНИЕ! НЕЗНАНИЕ ЗАКОНА НЕ ОСВОБОЖДАЕТ ОТ ОТВЕТСТВЕННОСТИ. -If you need some IT help - feel free to contact me (prefer e-mail or skype). -If you will find some issue in pyOpenRPA - write about it to me via e-mail/skype/gitlab issue. +pyOpenRPA - роботы Вам помогут! -Thank you! +************************************************** +Правообладатель +************************************************** + +ООО "ОПЕН РПА", ОГРН 1227700251350, ИНН/КПП 9718191421/771801001 +г. Москва: 125310, улица Муравская +г. Санкт-Петербург: 197022, улица Льва Толстого ************************************************** Центр поддержки клиентов @@ -26,9 +38,9 @@ Thank you! - Телефон/WhatsApp: +7 (995) 233-45-31 - Почта: Support@pyOpenRPA.ru -- Телеграм: @pyOpenRPA_support +- Телеграм: @pyOpenRPA_support :: `Написать `_ - Портал: https://pyopenrpa.ru/ -- Телеграм канал: @pyOpenRPA_support +- Телеграм канал: @pyOpenRPA :: `Присоединиться `_ ************************************************** Иван Маслов (Основатель & генеральный директор) @@ -36,26 +48,27 @@ Thank you! - Телефон/WhatsApp: +7 (906) 722-39-25 - Почта: Ivan.Maslov@pyOpenRPA.ru -- Телеграм: @IvanMaslov +- Телеграм: @IvanMaslov :: `Написать `_ - Портал: https://pyopenrpa.ru/ -- Телеграм канал: @pyOpenRPA_support +- Телеграм канал: @pyOpenRPA :: `Присоединиться `_ -************************************************** +********************************************************** Используемые сторонние компоненты (лицензионная чистота) -************************************************** +********************************************************** -- WinPython, v3.7.1 32-bit & 64-bit, лицензия MIT (https://github.com/winpython/winpython) -- Selenium, v..., лицензия Apache 2.0 (https://github.com/SeleniumHQ/selenium/blob/trunk/LICENSE) +- WinPython, v3.7.1 32-bit & 64-bit, лицензия MIT + https://github.com/winpython/winpython +- Selenium, v3.141.0, лицензия Apache 2.0 https://github.com/SeleniumHQ/selenium/blob/trunk/LICENSE) - pywinauto, v0.6.5, лицензия BSD 3-Clause (https://github.com/pywinauto/pywinauto) -- Semantic UI, v..., лицензия MIT (https://github.com/Semantic-Org/Semantic-UI) -- PyAutoGUI, v..., лицензия BSD 3-Clause (https://github.com/asweigart/pyautogui) -- keyboard, v..., лицензия MIT (https://github.com/boppreh/keyboard) -- pywin32 (win32api), v..., Python Software Foundation лицензия (PSF) (https://github.com/mhammond/pywin32) -- WMI, v..., лицензия MIT, (http://www.opensource.org/licenses/mit-license.php) -- psutil, v..., лицензия BSD 3-Clause (https://github.com/giampaolo/psutil/blob/master/LICENSE) -- Pillow PIL, v..., лицензия HPND (https://github.com/python-pillow/Pillow/blob/main/LICENSE) -- requests, v..., лицензия Apache 2.0 (https://github.com/psf/requests/blob/main/LICENSE) -- JsRender, v..., лицензия MIT (https://github.com/BorisMoore/jsrender/blob/master/MIT-LICENSE.txt) -- Handlebars, v..., лицензия MIT, (https://github.com/handlebars-lang/handlebars.js/blob/master/LICENSE) -- jinja2, v..., лицензия BSD 3-Clause, (https://github.com/pallets/jinja/blob/main/LICENSE.rst) \ No newline at end of file +- Semantic UI, v2.4.1, лицензия MIT (https://github.com/Semantic-Org/Semantic-UI) +- PyAutoGUI, v0.9.44, лицензия BSD 3-Clause (https://github.com/asweigart/pyautogui) +- keyboard, v0.13.3, лицензия MIT (https://github.com/boppreh/keyboard) +- pywin32 (win32api), v228, Python Software Foundation лицензия (PSF) (https://github.com/mhammond/pywin32) +- WMI, v1.4.9, лицензия MIT, (http://www.opensource.org/licenses/mit-license.php) +- psutil, v5.6.2, лицензия BSD 3-Clause (https://github.com/giampaolo/psutil/blob/master/LICENSE) +- Pillow PIL, v6.0.0, лицензия HPND (https://github.com/python-pillow/Pillow/blob/main/LICENSE) +- requests, v2.22.0, лицензия Apache 2.0 (https://github.com/psf/requests/blob/main/LICENSE) +- JsRender, v1.0.2, лицензия MIT (https://github.com/BorisMoore/jsrender/blob/master/MIT-LICENSE.txt) +- Handlebars, v4.1.2, лицензия MIT, (https://github.com/handlebars-lang/handlebars.js/blob/master/LICENSE) +- jinja2, v2.11.2, лицензия BSD 3-Clause, (https://github.com/pallets/jinja/blob/main/LICENSE.rst) \ No newline at end of file diff --git a/Sources/GuideSphinx/Orchestrator/01_Orchestrator.rst b/Sources/GuideSphinx/Orchestrator/01_Orchestrator.rst index 6004515a..f15992ed 100644 --- a/Sources/GuideSphinx/Orchestrator/01_Orchestrator.rst +++ b/Sources/GuideSphinx/Orchestrator/01_Orchestrator.rst @@ -5,6 +5,7 @@ pyOpenRPA Orchestrator is the executable process. The features of the orchestrator is: + - Centralized/decentralized user control interface (applicable and for business users and for technical users). Web based, support desktop, tablet, phone. - Automatized robots control (customized algorithms, robots scheduling) - Source code mega flexibility: Light Orchestrator architecture is good for own customization @@ -37,6 +38,7 @@ gSettings structure Orchestrator architecture ************************************ Orchestrator has several source code components: + - User/robot activity consolidated queue single thread (Processor) - User/robot activity asynchonus many threads (Processor) - Scheduler single thread (main) @@ -70,21 +72,12 @@ ATTENTION: In some cases (such as web transmition), when you can't transmit pyth Because the WEB space is not the Python executable space. Interaction between it spaces create by JSON protocol. So, we know than JSON apply int, float, str, bool, None, list, dict - that is all. .. note:: - Example - { - "Def":"DefAliasTest", # def link or def alias (look gSettings["Processor"]["AliasDefDict"]) - "ArgList":[1,2,3], # Args list - "ArgDict":{"ttt":1,"222":2,"dsd":3}, # Args dictionary - "ArgGSettings": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList) - "ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList) - }# Pay attention! Do not left comma symbol after the end of the dict - it can be interpretated like a turple.. - - -********** -References -********** - -`Python-sphinx`_ -.. target-notes:: -.. _`reStructuredText`: http://docutils.sourceforge.net/rst.html + Example + { + "Def":"DefAliasTest", # def link or def alias (look gSettings["Processor"]["AliasDefDict"]) + "ArgList":[1,2,3], # Args list + "ArgDict":{"ttt":1,"222":2,"dsd":3}, # Args dictionary + "ArgGSettings": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList) + "ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList) + }# Pay attention! Do not left comma symbol after the end of the dict - it can be interpretated like a turple.. diff --git a/Sources/GuideSphinx/Robot/02_uidesktop.rst b/Sources/GuideSphinx/Robot/02_uidesktop.rst index 2ad32908..99d23293 100644 --- a/Sources/GuideSphinx/Robot/02_uidesktop.rst +++ b/Sources/GuideSphinx/Robot/02_uidesktop.rst @@ -22,6 +22,10 @@ How to use both x32 and x64 python processes (it can be helpfully, if another ap UIDesktop.Utils.ProcessBitness.SettingsInit(lPyOpenRPA_SettingsDict) # Now you can use pyOpenRPA with both bitness. +.. automodule:: pyOpenRPA.Robot.Keyboard + :members: + :autosummary: + .. automodule:: pyOpenRPA.Robot.UIDesktop :members: diff --git a/Sources/GuideSphinx/Robot/04_keyboard.rst b/Sources/GuideSphinx/Robot/04_keyboard.rst index b3f0f318..ebb8fcaf 100644 --- a/Sources/GuideSphinx/Robot/04_keyboard.rst +++ b/Sources/GuideSphinx/Robot/04_keyboard.rst @@ -4,35 +4,221 @@ 4. Keyboard #################################### +************************************************** +Примеры использования +************************************************** + Here you can find the functions description for interaction with desktop GUI applications How to use both x32 and x64 python processes (it can be helpfully, if another app GUI is on another bitness than your app) .. code-block:: python - from pyOpenRPA.Robot import UIDesktop - #Section for robot init - lPyOpenRPA_SettingsDict = { - "Python32FullPath": "..\\Resources\\WPy32-3720\\python-3.7.2\\python.exe", #Set from user: "..\\Resources\\WPy32-3720\\python-3.7.2\\OpenRPARobotGUIx32.exe" - "Python64FullPath": "..\\Resources\\WPy64-3720\\python-3.7.2.amd64\\python.exe", #Set from user - "Python32ProcessName": "pyOpenRPA_UIDesktopX32.exe", #Config set once - "Python64ProcessName": "pyOpenRPA_UIDesktopX64.exe" #Config set once - } - # Init the pyOpenRPA configuration - UIDesktop.Utils.ProcessBitness.SettingsInit(lPyOpenRPA_SettingsDict) - # Now you can use pyOpenRPA with both bitness. + # Keyboard: Взаимодействие с клавиатурой + from pyOpenRPA.Robot import Keyboard + from pyOpenRPA.Robot import Clipboard + Keyboard.send("win+r") + time.sleep(0.3) + Keyboard.write("cmd") + time.sleep(0.3) + Keyboard.send("enter") + time.sleep(0.6) + Keyboard.write("echo %time%") + time.sleep(0.3) + Keyboard.send("enter") + time.sleep(0.3) + Keyboard.send("ctrl+a") + time.sleep(0.6) + Clipboard.ClipboardSet("") + Keyboard.send("ctrl+c") + time.sleep(0.6) + lTextRaw = Clipboard.ClipboardGet() + lTimeStr = lTextRaw.split("\n")[-3] + +************************************************** +Описание методов +************************************************** -.. automodule:: pyOpenRPA.Robot.UIDesktop +.. automodule:: pyOpenRPA.Robot.Keyboard :members: :autosummary: -********** -References -********** +************************************************** +Коды клавиш +************************************************** +Ниже представлены коды горячих клавиш, а также символов русской и английской раскладки. + +.. code-block:: python + + # ШЕСТНАДЦАТИРИЧНЫЙ СКАН-КОД В РУССКОЙ РАСКЛАДКЕ (НЕЗАВИСИМО ОТ ВЫБРАННОГО ЯЗЫКА НА КЛАВИАТУРЕ) + # ОТОБРАЖЕНИЕ СКАН КОДОВ НА КЛАВИАТУРЕ https://snipp.ru/handbk/scan-codes + + KEY_RUS_Ф = 0x1E #A + KEY_RUS_И = 0x30 #B + KEY_RUS_С = 0x2E #C + KEY_RUS_В = 0x20 #D + KEY_RUS_У = 0x12 #E + KEY_RUS_А = 0x21 #F + KEY_RUS_П = 0x22 #G + KEY_RUS_Р = 0x23 #H + KEY_RUS_Ш = 0x17 #I + KEY_RUS_О = 0x24 #J + KEY_RUS_Л = 0x25 #K + KEY_RUS_Д = 0x26 #L + KEY_RUS_Ь = 0x32 #M + KEY_RUS_Т = 0x31 #N + KEY_RUS_Щ = 0x18 #O + KEY_RUS_З = 0x19 #P + KEY_RUS_Й = 0x10 #Q + KEY_RUS_К = 0x13 #R + KEY_RUS_Ы = 0x1F #S + KEY_RUS_Е = 0x14 #T + KEY_RUS_Г = 0x16 #U + KEY_RUS_М = 0x2F #V + KEY_RUS_Ц = 0x11 #W + KEY_RUS_Ч = 0x2D #X + KEY_RUS_Н = 0x15 #Y + KEY_RUS_Я = 0x2C #Z + KEY_RUS_Ё = 0x29 #~ + KEY_RUS_Ж = 0x27 #: + KEY_RUS_Б = 0x33 #< + KEY_RUS_Ю = 0x34 #> + KEY_RUS_Х = 0x1A #[ + KEY_RUS_Ъ = 0x1B #] + KEY_RUS_Э = 0x28 #' + + KEY_ENG_A = 0x1E #A + KEY_ENG_B = 0x30 #B + KEY_ENG_C = 0x2E #C + KEY_ENG_D = 0x20 #D + KEY_ENG_E = 0x12 #E + KEY_ENG_F = 0x21 #F + KEY_ENG_G = 0x22 #G + KEY_ENG_H = 0x23 #H + KEY_ENG_I = 0x17 #I + KEY_ENG_J = 0x24 #J + KEY_ENG_K = 0x25 #K + KEY_ENG_L = 0x26 #L + KEY_ENG_M = 0x32 #M + KEY_ENG_N = 0x31 #N + KEY_ENG_O = 0x18 #O + KEY_ENG_P = 0x19 #P + KEY_ENG_Q = 0x10 #Q + KEY_ENG_R = 0x13 #R + KEY_ENG_S = 0x1F #S + KEY_ENG_T = 0x14 #T + KEY_ENG_U = 0x16 #U + KEY_ENG_V = 0x2F #V + KEY_ENG_W = 0x11 #W + KEY_ENG_X = 0x2D #X + KEY_ENG_Y = 0x15 #Y + KEY_ENG_Z = 0x2C #Z -`reStructuredText`_ -.. target-notes:: -.. _`reStructuredText`: http://docutils.sourceforge.net/rst.html + KEY_HOT_NUMPAD_0 = 0x52 + KEY_HOT_NUMPAD_1 = 0x4F + KEY_HOT_NUMPAD_2 = 0x50 + KEY_HOT_NUMPAD_3 = 0x51 + KEY_HOT_NUMPAD_4 = 0x4B + KEY_HOT_NUMPAD_5 = 0x4C + KEY_HOT_NUMPAD_6 = 0x4D + KEY_HOT_NUMPAD_7 = 0x47 + KEY_HOT_NUMPAD_8 = 0x48 + KEY_HOT_NUMPAD_9 = 0x49 + KEY_HOT_NUMPAD_ASTERISK = 0x37 #* + KEY_HOT_NUMPAD_PLUS = 0x4E + KEY_HOT_NUMPAD_MINUS = 0x4A + KEY_HOT_NUMPAD_DELETE = 0x53 + KEY_HOT_NUMPAD_SOLIDUS = 0x35 #/ + KEY_HOT_NUMPAD_ENTER = 0x11c + + KEY_HOT_F1 = 0x3B + KEY_HOT_F2 = 0x3C + KEY_HOT_F3 = 0x3D + KEY_HOT_F4 = 0x3E + KEY_HOT_F5 = 0x3F + KEY_HOT_F6 = 0x40 + KEY_HOT_F7 = 0x41 + KEY_HOT_F8 = 0x42 + KEY_HOT_F9 = 0x43 + KEY_HOT_F10 = 0x44 + KEY_HOT_F11 = 0x57 + KEY_HOT_F12 = 0x58 + KEY_HOT_F13 = 0x7C + KEY_HOT_F14 = 0x7D + KEY_HOT_F15 = 0x7E + KEY_HOT_F16 = 0x7F + KEY_HOT_F17 = 0x80 + KEY_HOT_F18 = 0x81 + KEY_HOT_F19 = 0x82 + KEY_HOT_F20 = 0x83 + KEY_HOT_F21 = 0x84 + KEY_HOT_F22 = 0x85 + KEY_HOT_F23 = 0x86 + KEY_HOT_F24 = 0x87 + + KEY_HOT_TILDE = 0x29 #~ + KEY_HOT_COLON = 0x27 #: + KEY_HOT_PLUS = 0x0D #+ + KEY_HOT_MINUS = 0x0C #- + KEY_HOT_LESS_THAN = 0x33 #< , + KEY_HOT_GREATER_THAN = 0x34 #> . + KEY_HOT_SOLIDUS = 0x35 #/ ? + KEY_HOT_SQUARE_BRACKET_LEFT = 0x1A #[ + KEY_HOT_SQUARE_BRACKET_RIGHT = 0x1B #] + KEY_HOT_APOSTROPHE = 0x28 #' " + KEY_HOT_VERTICAL_LINE = 0x2B #| \ + + KEY_HOT_ESC = 0x1 + KEY_HOT_BACKSPACE = 0x0E + KEY_HOT_TAB = 0x0F + KEY_HOT_ENTER = 0x1C + KEY_HOT_CONTEXT_MENU = 0x15D + KEY_HOT_SHIFT_LEFT = 0x2A + KEY_HOT_SHIFT_RIGHT = 0x36 + KEY_HOT_CTRL_LEFT = 0x1D + KEY_HOT_CTRL_RIGHT = 0x11D + KEY_HOT_ALT_LEFT = 0x38 + KEY_HOT_ALT_RIGHT = 0x138 + KEY_HOT_WIN_LEFT = 0x5B + KEY_HOT_WIN_RIGHT = 0x5C + KEY_HOT_CAPS_LOCK = 0x3A + KEY_HOT_NUM_LOCK = 0x45 + KEY_HOT_SCROLL_LOCK = 0x46 + KEY_HOT_END = 0x4F + KEY_HOT_HOME = 0x47 + KEY_HOT_SPACE = 0x39 + KEY_HOT_PAGE_UP = 0x49 + KEY_HOT_PAGE_DOWN = 0x51 + KEY_HOT_CLEAR = 0x4C + KEY_HOT_LEFT = 0x4B + KEY_HOT_UP = 0x48 + KEY_HOT_RIGHT = 0x4D + KEY_HOT_DOWN = 0x50 + KEY_HOT_PRINT_SCREEN = 0x137 + KEY_HOT_INSERT = 0x52 + KEY_HOT_DELETE = 0x53 + + KEY_HOT_0 = 0xB + KEY_HOT_1 = 0x2 + KEY_HOT_2 = 0x3 + KEY_HOT_3 = 0x4 + KEY_HOT_4 = 0x5 + KEY_HOT_5 = 0x6 + KEY_HOT_6 = 0x7 + KEY_HOT_7 = 0x8 + KEY_HOT_8 = 0x9 + KEY_HOT_9 = 0xA + +************************************************** +Дополнительная функциональность +************************************************** +Дополнительно модуль содержит функции вспомогательной библиотеки. Ознакомиться с описанием можно `Здесь `_ + +.. code-block:: python + + # Пример использования функции send + from pyOpenRPA.Robot import Keyboard + Keyboard.send(57) diff --git a/Sources/GuideSphinx/Tools/02_Defs.rst b/Sources/GuideSphinx/Tools/02_Defs.rst index b7ed9486..e118c2ac 100644 --- a/Sources/GuideSphinx/Tools/02_Defs.rst +++ b/Sources/GuideSphinx/Tools/02_Defs.rst @@ -5,6 +5,7 @@ How to use StopSafe on the robot side .. code-block:: python + from pyOpenRPA.Tools import StopSafe StopSafe.Init(inLogger=None) StopSafe.IsSafeStop() # True - WM_CLOSE SIGNAL has come. taskkill /im someprocess.exe @@ -18,13 +19,3 @@ How to use StopSafe on the robot side .. automodule:: pyOpenRPA.Tools.Debugger :members: :autosummary: - - -********** -References -********** - -`reStructuredText`_ - -.. target-notes:: -.. _`reStructuredText`: http://docutils.sourceforge.net/rst.html diff --git a/Sources/GuideSphinx/conf.py b/Sources/GuideSphinx/conf.py index 1de36500..6b3fb3f1 100644 --- a/Sources/GuideSphinx/conf.py +++ b/Sources/GuideSphinx/conf.py @@ -13,8 +13,9 @@ import os import sys import sphinx_rtd_theme -import pyOpenRPA + sys.path.insert(0, os.path.abspath(r'..')) +import pyOpenRPA import datetime # -- Project information ----------------------------------------------------- @@ -30,7 +31,6 @@ author = f'{pyOpenRPA.__author__}' rst_epilog = """ .. |release| replace:: {release} - .. |author| replace:: {author} """.format( release = release,author = author, ) diff --git a/Sources/GuideSphinx/index.rst b/Sources/GuideSphinx/index.rst index 5e7e861b..2ac9ce60 100644 --- a/Sources/GuideSphinx/index.rst +++ b/Sources/GuideSphinx/index.rst @@ -44,12 +44,13 @@ pyOpenRPA - роботы вам помогут! Портал состоит из следующих разделов: ############################################ -- ОБЩЕЕ -- МОДУЛЬ РОБОТ -- МОДУЛЬ СТУДИЯ -- МОДУЛЬ ОРКЕСТРАТОР -- МОДУЛЬ АГЕНТ -- ИНСТРУМЕНТЫ + +- Общее +- Модуль робот +- Модуль студия +- Модуль оркестратор +- Модуль агент +- Инструменты ОБЩЕЕ @@ -108,6 +109,11 @@ The pyOpenRPA.Agent tool has been developed to maintain robot infrastructure (2+ - Get screenshots from the RPA GUI session - Get the list of the running processes + + + + + ************************************************** Технические требования ************************************************** diff --git a/Sources/pyOpenRPA/Orchestrator/Managers/ControlPanel.py b/Sources/pyOpenRPA/Orchestrator/Managers/ControlPanel.py index cef4acd4..599eed11 100644 --- a/Sources/pyOpenRPA/Orchestrator/Managers/ControlPanel.py +++ b/Sources/pyOpenRPA/Orchestrator/Managers/ControlPanel.py @@ -39,6 +39,7 @@ class ControlPanel(): Jinja2DataUpdateDictSet .. code-block:: html + Hello my control panel! You can use any def from Orchestrator module here in Jinja2 HTML template: Example: OrchestratorModule.OSCMD(inCMDStr="notepad") diff --git a/Sources/pyOpenRPA/Orchestrator/Managers/Process.py b/Sources/pyOpenRPA/Orchestrator/Managers/Process.py index 276e4adc..ff47c075 100644 --- a/Sources/pyOpenRPA/Orchestrator/Managers/Process.py +++ b/Sources/pyOpenRPA/Orchestrator/Managers/Process.py @@ -22,6 +22,7 @@ class Process(): - 5_STARTED_MANUAL .. code-block:: python + # For the safe init class use ProcessInitSafe lProcess = Orchestrator.Managers.ProcessInitSafe(inAgentHostNameStr="PCNAME",inAgentUserNameStr="USER", inProcessNameWOExeStr="notepad",inStartCMDStr="notepad",inStopSafeTimeoutSecFloat=3) @@ -35,6 +36,7 @@ class Process(): How to use StopSafe on the robot side .. code-block:: python + from pyOpenRPA.Tools import StopSafe StopSafe.Init(inLogger=None) StopSafe.IsSafeStop() # True - WM_CLOSE SIGNAL has come. taskkill /im someprocess.exe diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index d9eb4dac..7b172531 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -546,10 +546,10 @@ def OrchestratorLoggerGet() -> logging.Logger: def OrchestratorScheduleGet() -> schedule: """ Get the schedule (schedule.readthedocs.io) from the Orchestrator - - Fro example you can use: + For example you can use: .. code-block:: python + # One schedule threaded Orchestrator.OrchestratorScheduleGet().every(5).seconds.do(lProcess.StatusCheckStart) @@ -620,6 +620,7 @@ def OrchestratorPySearchInit(inGlobPatternStr, inDefStr = None, inDefArgNameGSet """ Search the py files by the glob and do the safe init (in try except). Also add inited module in sys.modules as imported (module name = file name without extension). You can init CP in async way! + .. code-block:: python # USAGE VAR 1 (without the def auto call) @@ -639,7 +640,6 @@ def OrchestratorPySearchInit(inGlobPatternStr, inDefStr = None, inDefArgNameGSet except Exception as e: gSettings["Logger"].exception(f"Exception when init CP. See below.") - :param inGlobPatternStr: example"..\\*\\*\\*X64*.cmd" :param inDefStr: OPTIONAL The string name of the def. For backward compatibility if you need to auto call some def from initialized module :param inDefArgNameGSettingsStr: OPTIONAL The name of the GSettings argument in def (if exists) @@ -733,7 +733,6 @@ def OrchestratorSessionRestore(inGSettings=None): Check _SessioLast... files in working directory. if exist - load into gsettings (from version 1.2.7) _SessionLast_GSettings.pickle (binary) - (above the version 1.2.7) _SessionLast_RDPList.json (encoding = "utf-8") _SessionLast_StorageDict.pickle (binary) diff --git a/Sources/pyOpenRPA/Robot/Keyboard.py b/Sources/pyOpenRPA/Robot/Keyboard.py index b6a278fc..137e2056 100644 --- a/Sources/pyOpenRPA/Robot/Keyboard.py +++ b/Sources/pyOpenRPA/Robot/Keyboard.py @@ -1 +1,204 @@ -from keyboard import * \ No newline at end of file +from keyboard import * +import time +# ШЕСТНАДЦАТИРИЧНЫЙ СКАН-КОД В РУССКОЙ РАСКЛАДКЕ (НЕЗАВИСИМО ОТ ВЫБРАННОГО ЯЗЫКА НА КЛАВИАТУРЕ) +# ОТОБРАЖЕНИЕ СКАН КОДОВ НА КЛАВИАТУРЕ https://snipp.ru/handbk/scan-codes + +KEY_RUS_Ф = 0x1E #A +KEY_RUS_И = 0x30 #B +KEY_RUS_С = 0x2E #C +KEY_RUS_В = 0x20 #D +KEY_RUS_У = 0x12 #E +KEY_RUS_А = 0x21 #F +KEY_RUS_П = 0x22 #G +KEY_RUS_Р = 0x23 #H +KEY_RUS_Ш = 0x17 #I +KEY_RUS_О = 0x24 #J +KEY_RUS_Л = 0x25 #K +KEY_RUS_Д = 0x26 #L +KEY_RUS_Ь = 0x32 #M +KEY_RUS_Т = 0x31 #N +KEY_RUS_Щ = 0x18 #O +KEY_RUS_З = 0x19 #P +KEY_RUS_Й = 0x10 #Q +KEY_RUS_К = 0x13 #R +KEY_RUS_Ы = 0x1F #S +KEY_RUS_Е = 0x14 #T +KEY_RUS_Г = 0x16 #U +KEY_RUS_М = 0x2F #V +KEY_RUS_Ц = 0x11 #W +KEY_RUS_Ч = 0x2D #X +KEY_RUS_Н = 0x15 #Y +KEY_RUS_Я = 0x2C #Z +KEY_RUS_Ё = 0x29 #~ +KEY_RUS_Ж = 0x27 #: +KEY_RUS_Б = 0x33 #< +KEY_RUS_Ю = 0x34 #> +KEY_RUS_Х = 0x1A #[ +KEY_RUS_Ъ = 0x1B #] +KEY_RUS_Э = 0x28 #' + +KEY_ENG_A = 0x1E #A +KEY_ENG_B = 0x30 #B +KEY_ENG_C = 0x2E #C +KEY_ENG_D = 0x20 #D +KEY_ENG_E = 0x12 #E +KEY_ENG_F = 0x21 #F +KEY_ENG_G = 0x22 #G +KEY_ENG_H = 0x23 #H +KEY_ENG_I = 0x17 #I +KEY_ENG_J = 0x24 #J +KEY_ENG_K = 0x25 #K +KEY_ENG_L = 0x26 #L +KEY_ENG_M = 0x32 #M +KEY_ENG_N = 0x31 #N +KEY_ENG_O = 0x18 #O +KEY_ENG_P = 0x19 #P +KEY_ENG_Q = 0x10 #Q +KEY_ENG_R = 0x13 #R +KEY_ENG_S = 0x1F #S +KEY_ENG_T = 0x14 #T +KEY_ENG_U = 0x16 #U +KEY_ENG_V = 0x2F #V +KEY_ENG_W = 0x11 #W +KEY_ENG_X = 0x2D #X +KEY_ENG_Y = 0x15 #Y +KEY_ENG_Z = 0x2C #Z + + +KEY_HOT_NUMPAD_0 = 0x52 +KEY_HOT_NUMPAD_1 = 0x4F +KEY_HOT_NUMPAD_2 = 0x50 +KEY_HOT_NUMPAD_3 = 0x51 +KEY_HOT_NUMPAD_4 = 0x4B +KEY_HOT_NUMPAD_5 = 0x4C +KEY_HOT_NUMPAD_6 = 0x4D +KEY_HOT_NUMPAD_7 = 0x47 +KEY_HOT_NUMPAD_8 = 0x48 +KEY_HOT_NUMPAD_9 = 0x49 +KEY_HOT_NUMPAD_ASTERISK = 0x37 #* +KEY_HOT_NUMPAD_PLUS = 0x4E +KEY_HOT_NUMPAD_MINUS = 0x4A +KEY_HOT_NUMPAD_DELETE = 0x53 +KEY_HOT_NUMPAD_SOLIDUS = 0x35 #/ +KEY_HOT_NUMPAD_ENTER = 0x11c + +KEY_HOT_F1 = 0x3B +KEY_HOT_F2 = 0x3C +KEY_HOT_F3 = 0x3D +KEY_HOT_F4 = 0x3E +KEY_HOT_F5 = 0x3F +KEY_HOT_F6 = 0x40 +KEY_HOT_F7 = 0x41 +KEY_HOT_F8 = 0x42 +KEY_HOT_F9 = 0x43 +KEY_HOT_F10 = 0x44 +KEY_HOT_F11 = 0x57 +KEY_HOT_F12 = 0x58 +KEY_HOT_F13 = 0x7C +KEY_HOT_F14 = 0x7D +KEY_HOT_F15 = 0x7E +KEY_HOT_F16 = 0x7F +KEY_HOT_F17 = 0x80 +KEY_HOT_F18 = 0x81 +KEY_HOT_F19 = 0x82 +KEY_HOT_F20 = 0x83 +KEY_HOT_F21 = 0x84 +KEY_HOT_F22 = 0x85 +KEY_HOT_F23 = 0x86 +KEY_HOT_F24 = 0x87 + +KEY_HOT_TILDE = 0x29 #~ +KEY_HOT_COLON = 0x27 #: +KEY_HOT_PLUS = 0x0D #+ +KEY_HOT_MINUS = 0x0C #- +KEY_HOT_LESS_THAN = 0x33 #< , +KEY_HOT_GREATER_THAN = 0x34 #> . +KEY_HOT_SOLIDUS = 0x35 #/ ? +KEY_HOT_SQUARE_BRACKET_LEFT = 0x1A #[ +KEY_HOT_SQUARE_BRACKET_RIGHT = 0x1B #] +KEY_HOT_APOSTROPHE = 0x28 #' " +KEY_HOT_VERTICAL_LINE = 0x2B #| \ + +KEY_HOT_ESC = 0x1 +KEY_HOT_BACKSPACE = 0x0E +KEY_HOT_TAB = 0x0F +KEY_HOT_ENTER = 0x1C +KEY_HOT_CONTEXT_MENU = 0x15D +KEY_HOT_SHIFT_LEFT = 0x2A +KEY_HOT_SHIFT_RIGHT = 0x36 +KEY_HOT_CTRL_LEFT = 0x1D +KEY_HOT_CTRL_RIGHT = 0x11D +KEY_HOT_ALT_LEFT = 0x38 +KEY_HOT_ALT_RIGHT = 0x138 +KEY_HOT_WIN_LEFT = 0x5B +KEY_HOT_WIN_RIGHT = 0x5C +KEY_HOT_CAPS_LOCK = 0x3A +KEY_HOT_NUM_LOCK = 0x45 +KEY_HOT_SCROLL_LOCK = 0x46 +KEY_HOT_END = 0x4F +KEY_HOT_HOME = 0x47 +KEY_HOT_SPACE = 0x39 +KEY_HOT_PAGE_UP = 0x49 +KEY_HOT_PAGE_DOWN = 0x51 +KEY_HOT_CLEAR = 0x4C +KEY_HOT_LEFT = 0x4B +KEY_HOT_UP = 0x48 +KEY_HOT_RIGHT = 0x4D +KEY_HOT_DOWN = 0x50 +KEY_HOT_PRINT_SCREEN = 0x137 +KEY_HOT_INSERT = 0x52 +KEY_HOT_DELETE = 0x53 + +KEY_HOT_0 = 0xB +KEY_HOT_1 = 0x2 +KEY_HOT_2 = 0x3 +KEY_HOT_3 = 0x4 +KEY_HOT_4 = 0x5 +KEY_HOT_5 = 0x6 +KEY_HOT_6 = 0x7 +KEY_HOT_7 = 0x8 +KEY_HOT_8 = 0x9 +KEY_HOT_9 = 0xA + +def Write(inTextStr:str, inDelayFloat:float=0, inRestoreStateAfterBool:bool=True, inExactBool:bool=None): + """ + Печать текста. Не зависит от текущей раскладки клавиатуры! Посылает искусственные клавишные события в ОС, моделируя печать данного текста. Знаки, не доступные на клавиатуре, напечатаны как явный unicode знаки, использующие определенную для ОС функциональность, такие как alt+codepoint. + Чтобы гарантировать текстовую целостность, все в настоящее время нажатые ключи выпущены прежде текст напечатан, и модификаторы восстановлены впоследствии. + + :param inTextStr: Текст, отправляемый на печать. Не зависит от текущей раскладки клавиатуры! + :type inTextStr: str + :param inDelayFloat: Число секунд, которое ожидать между нажатиями. defaults to 0 + :type inDelayFloat: float, опционально + :param inRestoreStateAfterBool: Может использоваться, чтобы восстановить регистр нажатых ключей после того, как текст напечатан, т.е. нажимает ключи, которые были выпущены в начало. + :type inRestoreStateAfterBool: bool, опционально + :param inExactBool: Печатает все знаки как явный unicode. Необязательный параметр + :type inExactBool: bool, опционально + """ + write(text=inTextStr, delay=inDelayFloat, restore_state_after=inRestoreStateAfterBool, exact=inExactBool) + +def HotkeyCombination(*inKeyList, inDelaySecFloat = 0.3): + """Получает перечень кнопок для одновременного нажатия. Между нажатиями программа ожидания время inDelaySecFloat + + .. code-block:: python + + # Keyboard: Взаимодействие с клавиатурой + from pyOpenRPA.Robot import Keyboard + Keyboard.HotkeyCombination("ctrl",Keyboard.KEY_ENG_A) # Ctrl + a + Keyboard.HotkeyCombination("ctrl",Keyboard.KEY_ENG_C) # Ctrl + c + + :param inKeyList: Список клавиш для одновременного нажатия + :param inDelaySecFloat: Интервал между нажатиями. Необходим в связи с тем, что операционной системе требуется время на реакцию на нажатие клавиш, по умолчанию: 0.3 + :type inDelaySecFloat: float, опционально + """ + for l_key_item in inKeyList: + press(l_key_item) + time.sleep(inDelaySecFloat) + for l_key_item in inKeyList: + release(l_key_item) + +def HotkeyCtrlA_CtrlC() -> None: + """Выполнить выделение текста, после чего скопировать его в буфер обмена + + """ + HotkeyCombination("ctrl",KEY_ENG_A) # Ctrl + a + HotkeyCombination("ctrl",KEY_ENG_C) # Ctrl + c \ No newline at end of file diff --git a/changelog.md b/changelog.md index 72ed5f83..d5b000b9 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,8 @@ AGT - AGENT [1.2.13] - ORCHESTRATOR - - def WebRequestResponseSend(inResponeStr, inRequest=None, inContentTypeStr: str = None, inHeadersDict: dict = None): +- ROBOT +- - Keyboard, add hotkey codes (up, down, ctr, alt, etc) [1.2.12] 2022_Q2