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/Tools/Jupyter-notebooks/Quickstart/.ipynb_checkpoints/Robot-checkpoint.ipynb

468 lines
11 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Робот: быстрый запуск (quickstart) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Уважаемый пользователь! Данный файл содержит набор преднастроенных команд для ускоренной проверки гипотез роботизации. В"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Box(left=550, top=244, width=29, height=29), Box(left=550, top=298, width=29, height=29), Box(left=550, top=352, width=29, height=29), Box(left=550, top=406, width=29, height=29), Box(left=550, top=460, width=29, height=29), Box(left=550, top=514, width=29, height=29), Box(left=550, top=568, width=29, height=29), Box(left=550, top=622, width=29, height=29), Box(left=550, top=676, width=29, height=29), Box(left=550, top=730, width=29, height=29), Box(left=550, top=784, width=29, height=29), Box(left=550, top=838, width=29, height=29)]\n"
]
}
],
"source": [
"import sys\n",
"import os\n",
"sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\Sources\"))\n",
"sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\..\\\\KPI_Effect\\\\packages\"))\n",
"import time\n",
"from pyOpenRPA.Robot import Keyboard\n",
"\n",
"# Screen: Взаимодействие с объектами экрана\n",
"from pyOpenRPA.Robot import Screen\n",
"lBoxList = Screen.ImageLocateAll(inImgPathStr=\"screencontact.PNG\",inConfidenceFloat=0.9)\n",
"print(lBoxList)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#ИМПОРТ ДИРЕКТОРИИ\n",
"import sys\n",
"import os\n",
"sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\..\\\\KPI_Effect\\\\packages\"))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Box(left=500, top=244, width=29, height=29), Box(left=500, top=298, width=29, height=29), Box(left=500, top=352, width=29, height=29), Box(left=500, top=406, width=29, height=29), Box(left=500, top=460, width=29, height=29), Box(left=500, top=514, width=29, height=29), Box(left=500, top=568, width=29, height=29), Box(left=500, top=622, width=29, height=29), Box(left=500, top=676, width=29, height=29), Box(left=500, top=730, width=29, height=29), Box(left=500, top=784, width=29, height=29), Box(left=500, top=838, width=29, height=29)]\n"
]
}
],
"source": [
"lBox2List = Screen.BoxMoveTo(inBox=lBoxList,inDXInt=-50)\n",
"print(lBox2List)\n",
"Screen.BoxDraw(inBox = lBox2List)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"lPoint = Screen.BoxGetPoint(lBox2List[0])"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"Screen.PointClick(lPoint)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Box(left=489, top=243, width=46, height=32)]\n"
]
}
],
"source": [
"lBoxList = Screen.ImageLocateAll(inImgPathStr=\"sendmessage.PNG\",inConfidenceFloat=0.9)\n",
"print(lBoxList)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"Screen.PointClick(Screen.BoxGetPoint(Screen.ImageLocateAll(inImgPathStr=\"sendmessage.PNG\",inConfidenceFloat=0.9)[0]))"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Box(left=169, top=193, width=409, height=687)]"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Screen.ImageLocateAll(inImgPathStr=\"emptytray.PNG\",inConfidenceFloat=0.9)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import importlib"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"123\n"
]
},
{
"data": {
"text/plain": [
"<module 'pak.test' from 'C:\\\\Abs\\\\Archive\\\\scopeSrcUL\\\\pyOpenRPA\\\\Tools\\\\Jupyter-notebooks\\\\pak\\\\test.py'>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"importlib.import_module(\".test\",\"pak\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import sys"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<module 'pak' (namespace)>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sys.modules[\"pak\"]"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import datetime"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 9, 26, 20, 58, 26, 931399)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"datetime.datetime.now()+datetime.timedelta(hours=3)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.timedelta(seconds=10800)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"datetime.timedelta(hours=3)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'2022-09-26 17:59:17'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g_datetime_format_str = '%Y-%m-%d %H:%M:%S'\n",
"(datetime.datetime.now()).strftime(g_datetime_format_str)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"import time"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 9, 26, 18, 1, 58, 924492)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"datetime.datetime.fromtimestamp(time.time())"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\".endswith(\"/\")"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'kpi_client' from '__main__' (unknown location)",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-15-2f86ae4ce68c>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mkpi_client\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mImportError\u001b[0m: cannot import name 'kpi_client' from '__main__' (unknown location)"
]
}
],
"source": [
"from . import kpi_client"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"#ИМПОРТ ДИРЕКТОРИИ\n",
"import sys\n",
"import os\n",
"sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\..\\\\KPI_Effect\\\\packages\"))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import kpi_client\n",
"kpi_client.init(\"http://localhost:1024\", \"1992-04-03-0643-ru-b4ff-openrpa52zzz\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-----------START-----------\n",
"POST http://localhost:1024/orpa/api/activity-list-execute\r\n",
"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n",
"Cookie: AuthToken=1992-04-03-0643-ru-b4ff-openrpa52zzz\r\n",
"Content-Length: 466\r\n",
"\r\n",
"b'[{\"Def\": \"kpi_control_panel.actions.log\", \"ArgList\": [], \"ArgDict\": {\"in_code_str\": \"asd\", \"in_group_str\": \"\\\\u041f\\\\u0440\\\\u0438\\\\u0432\\\\u0435\\\\u0442!\", \"in_manual_operation_float\": 190, \"in_auto_operation_float\": 88, \"in_start_time_float\": 123124, \"in_comment_str\": \"-\", \"in_count_int\": 1, \"in_sla_percent_float\": 1.0, \"in_dev_next_mvp_float\": 1.0, \"in_revenue_float\": 0.0, \"in_fine_float\": 0.0, \"in_reputation_str\": \"-\"}, \"ArgGSettingsStr\": null, \"ArgLoggerStr\": null}]'\n"
]
}
],
"source": [
"kpi_client.log(in_code_str=\"asd\",in_group_str=\"Привет!\",in_manual_operation_float=190, in_auto_operation_float=88, in_start_time_float=123124)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"print(\"\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}