...
 
Commits (7)
Metadata-Version: 2.1
Name: pyOpenRPA
Version: 1.0.37
Version: 1.0.39
Summary: First open source RPA platform for business
Home-page: https://gitlab.com/UnicodeLabs/OpenRPA
Author: Ivan Maslov
......
pyOpenRPA-1.0.37.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyOpenRPA-1.0.37.dist-info/METADATA,sha256=NvEs1xItXmuAnPaTzTs5kDpr6NhwdD4_WyFwvG9UTLo,3510
pyOpenRPA-1.0.37.dist-info/RECORD,,
pyOpenRPA-1.0.37.dist-info/WHEEL,sha256=qB97nP5e4MrOsXW5bIU5cUn_KSVr10EV0l-GCHG9qNs,97
pyOpenRPA-1.0.37.dist-info/top_level.txt,sha256=RPzwQXgYBRo_m5L3ZLs6Voh8aEkMeT29Xsul1w1qE0g,10
pyOpenRPA-1.0.39.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyOpenRPA-1.0.39.dist-info/METADATA,sha256=KSr_y71FFd5y4tYQHnz80Pj_96WCYKwWbW5eK0hd4KM,3510
pyOpenRPA-1.0.39.dist-info/RECORD,,
pyOpenRPA-1.0.39.dist-info/WHEEL,sha256=qB97nP5e4MrOsXW5bIU5cUn_KSVr10EV0l-GCHG9qNs,97
pyOpenRPA-1.0.39.dist-info/top_level.txt,sha256=RPzwQXgYBRo_m5L3ZLs6Voh8aEkMeT29Xsul1w1qE0g,10
pyOpenRPA/Orchestrator/Orchestrator.py,sha256=UKp7eqvWDM91kYLwl2mo0UB8Pw-qu8eJCsR9NEXD1aU,6436
pyOpenRPA/Orchestrator/Processor.py,sha256=HQQyOVX-d5vPO-YULyTxVOtXtUMfvpAaSVO4xXxaKVI,9107
pyOpenRPA/Orchestrator/Server.py,sha256=aWDecl4_UUU00YG-pOXxyL7IvN5NK3efABt92y6M2kg,22136
pyOpenRPA/Orchestrator/Processor.py,sha256=kmGNIqe6AZMSrzCt1QlonEy58ecFeLunjo8AeRMsufU,11091
pyOpenRPA/Orchestrator/Server.py,sha256=QQK1rMZSg-pL9pJ059AoxIHHj4aFr1OWivdOEKPh9cs,22026
pyOpenRPA/Orchestrator/ServerSettings.py,sha256=jOXJTLwg8cJx6D-rN8J4dn5RCb2nepAhCH4F9hYVUdM,4912
pyOpenRPA/Orchestrator/Timer.py,sha256=FQZ3y6G9d47Ybx7RewzePKQV77H4gCkx5SaeFVlsuhc,2095
pyOpenRPA/Orchestrator/Web/Index.xhtml,sha256=su4tsDD_ZMbQz6Tbmqj55SM0ZZxuQw9tfPcytaB8wzs,32953
......@@ -195,7 +195,7 @@ pyOpenRPA/Robot/Clipboard.py,sha256=q76X8L21zJwcwdoJJNPeCEwAV30xS6ylHP1WwvtxoWI,
pyOpenRPA/Robot/OrchestratorConnector.py,sha256=Fihxz-jH9M4VakXEE0SZ0Vo9tLEQk8Tcg_C4HoH45gI,20037
pyOpenRPA/Robot/SettingsTemplate.py,sha256=Rp5XPeV2I4tCS2uf4Zkqm_ERJ6pZMg4-e5_lMqGJYLk,1453
pyOpenRPA/Robot/Test.py,sha256=qXr990nXiFZX5SNv6QN9GLb_U4HZRmJnbZR2qSnwilY,2878
pyOpenRPA/Robot/UIDesktop.py,sha256=MWdWr0dZpk1PL1rsD91q6_8v687CSDBx1_T7IuHd3-E,77473
pyOpenRPA/Robot/UIDesktop.py,sha256=3I2bllTDvR9d10O2ltkjoKmYw34wkkDAZfPlRpwbj30,77476
pyOpenRPA/Robot/Utils/JSONNormalize.py,sha256=aIuVzuZDazhxkCOzoOjfhHVz66mp2FWdfPv5E7KWF5Y,3890
pyOpenRPA/Robot/Utils/ProcessBitness.py,sha256=WlKL-DklGaoTnchtapOTM_ydxSB4yOeo9lcG3zr2VME,4524
pyOpenRPA/Robot/Utils/ProcessCommunicator.py,sha256=8GfmLnOvAdosmt7YNT86uEV9cjhKippssCX62wOMJwM,8039
......@@ -235,6 +235,18 @@ pyOpenRPA/Studio/__pycache__/Studio.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/ValueVerify.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/ExcelCom.py,sha256=hp0dvXOEC7Au00ueh7pqxkdixV-PC-km7tCt-wRunYs,343
pyOpenRPA/Tools/RobotDB/RobotDB.py,sha256=DZSb17fiCAYLdNVTLFJ7nTbQhk29PjzxE9OL6ydCDcI,1645
pyOpenRPA/Tools/RobotDB/Server.py,sha256=RO4Rj5-hmrRB41XKm4CrSFtauzKj3wNq4VmgcxhseeY,19838
pyOpenRPA/Tools/RobotDB/ServerSettings.py,sha256=5p9JwrpKHh68oVHIWazTajB6AOfzeapARbvGcJOFmNc,7406
pyOpenRPA/Tools/RobotDB/__init__.py,sha256=qVH8fEPgXk54rmy-ol0PnT8GF5OlGE0a8mExwJ4tFqY,124
pyOpenRPA/Tools/RobotDB/__main__.py,sha256=w9sXIF4r_PeWJjHJutTuH8DSYpXxpgcAN0KUOjiJ6PI,140
pyOpenRPA/Tools/RobotDB/__pycache__/ExcelCom.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/RobotDB.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/Server.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/ServerSettings.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotRDPActive/Connector.py,sha256=qU5SXwHgQU177MjqEHyOwJDLAcSVnIkKKw76iD09J1w,7275
pyOpenRPA/Tools/RobotRDPActive/Monitor.py,sha256=H7ciateTh-hml8z69EYZjYgqdTZGkDRtnFwuYnytrCw,3278
pyOpenRPA/Tools/RobotRDPActive/Template.rdp,sha256=qPCLkjzTdYKURK7nRApkPUjRuS4K20vDPj9DIUNSSkE,2392
......@@ -255,5 +267,5 @@ pyOpenRPA/Tools/RobotScreenActive/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotScreenActive/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
pyOpenRPA/Tools/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/__init__.py,sha256=32Po3gFALn9l6ft6LTFVJBkBj-1p5hP83AVcQ_FTa0s,175
pyOpenRPA/__init__.py,sha256=iZp06tUV8Mw7GGdUcuW_faV4YaQEJa_n5BqxOl0cwx8,175
pyOpenRPA/__pycache__/__init__.cpython-37.pyc,,
......@@ -7,6 +7,7 @@ import sys
import subprocess
import copy
import importlib
import psutil
#Input arg
# [
# {
......@@ -38,6 +39,13 @@ import importlib
#
# },
# {
# "Type":"ProcessStartIfTurnedOff",
# "CheckTaskName":"", #Check if current task name is not active (then start process),
# "Path":"",
# "ArgList":[]
#
# },
# {
# "Type":"ProcessStop",
# "Name":"",
# "FlagForce":True,
......@@ -71,6 +79,7 @@ def Activity(inActivity):
inActivity["DateTimeUTCStringStart"] = datetime.datetime.strftime(datetime.datetime.now(),"%Y-%m-%dT%H:%M:%S.%f")
#Alias (compatibility)
lItem = inActivity
lCurrentDateTime = datetime.datetime.now()
###########################################################
#Обработка запроса на отправку команды на удаленную машину
###########################################################
......@@ -138,11 +147,33 @@ def Activity(inActivity):
#Вид активности - запуск процесса
#Запись в массив отработанных активностей
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["activityType"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["processPath"], "activityStartDateTime":str(lCurrentDateTime)})
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Path"], "activityStartDateTime":str(lCurrentDateTime)})
#Запустить процесс
lItemArgs=[lItem["processPath"]]
lItemArgs.extend(lItem["processArgs"])
lItemArgs=[lItem["Path"]]
lItemArgs.extend(lItem["ArgList"])
subprocess.Popen(lItemArgs,shell=True)
#####################################
#ProcessStartIfTurnedOff
#####################################
if lItem["Type"]=="ProcessStartIfTurnedOff":
#Check if process running
#remove .exe from Taskname if exists
lCheckTaskName = lItem["CheckTaskName"]
if len(lCheckTaskName)>4:
if lCheckTaskName[-4:].upper() != ".EXE":
lCheckTaskName = lCheckTaskName+".exe"
else:
lCheckTaskName = lCheckTaskName+".exe"
#Check if process exist
if not CheckIfProcessRunning(lCheckTaskName):
#Вид активности - запуск процесса
#Запись в массив отработанных активностей
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Path"], "activityStartDateTime":str(lCurrentDateTime)})
#Запустить процесс
lItemArgs=[lItem["Path"]]
lItemArgs.extend(lItem["ArgList"])
subprocess.Popen(lItemArgs,shell=True)
#################################
#ProcessStop
#################################
......@@ -150,7 +181,7 @@ def Activity(inActivity):
#Вид активности - остановка процесса
#часовой пояс пока не учитываем
#Сформировать команду на завершение
lActivityCloseCommand='taskkill /im '+lItem["processName"]
lActivityCloseCommand='taskkill /im '+lItem["Name"]
#TODO Сделать безопасную обработку,если параметра нет в конфигурации
if lItem.get('FlagForce',False):
lActivityCloseCommand+=" /F"
......@@ -158,7 +189,7 @@ def Activity(inActivity):
if lItem.get('User',"")!="":
lActivityCloseCommand+=f' /fi "username eq {lItem["User"]}"'
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["activityType"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["processName"], "activityStartDateTime":str(lCurrentDateTime)})
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Name"], "activityStartDateTime":str(lCurrentDateTime)})
#Завершить процесс
os.system(lActivityCloseCommand)
#################################
......@@ -213,4 +244,18 @@ def ActivityListOrDict(inActivityListOrDict):
return lResult
if type(inActivityListOrDict)==dict:
#Dict activity
return Activity(inActivityListOrDict)
\ No newline at end of file
return Activity(inActivityListOrDict)
def CheckIfProcessRunning(processName):
'''
Check if there is any running process that contains the given name processName.
'''
#Iterate over the all the running process
for proc in psutil.process_iter():
try:
# Check if process name contains the given name string.
if processName.lower() in proc.name().lower():
return True
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return False;
\ No newline at end of file
......@@ -425,8 +425,6 @@ class RobotDaemonServer(Thread):
#httpd = HTTPServer(server_address, testHTTPServer_RequestHandler)
# Logging
mGlobalDict["Logger"].info(f"Server init. Listen URL: {inServerAddress}, Listen port: {inPort}")
# Запуск адреса в браузере
os.system("explorer http://127.0.0.1:8081")
#httpd.serve_forever()
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
#print('Starting server, use <Ctrl-C> to stop')
......
......@@ -1208,7 +1208,7 @@ def UIOSelector_Highlight(inUIOSelector):
UIO_Highlight(UIOSelector_Get_UIO(inUIOSelector))
else:
# Run function from other process with help of PIPE
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Exist_Bool",
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Highlight",
"ArgumentList": [inUIOSelector],
"ArgumentDict": {}}
# Отправить запрос в дочерний процесс, который отвечает за работу с Windows окнами
......@@ -1233,7 +1233,7 @@ def UIOSelector_FocusHighlight(inUIOSelector):
UIO_FocusHighlight(UIOSelector_Get_UIO(inUIOSelector))
else:
# Run function from other process with help of PIPE
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Exist_Bool",
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_FocusHighlight",
"ArgumentList": [inUIOSelector],
"ArgumentDict": {}}
# Отправить запрос в дочерний процесс, который отвечает за работу с Windows окнами
......
import win32com.client as win32
def OpenWorkbook(xlapp, xlfile):
try:
xlwb = xlapp.Workbooks(xlfile)
except Exception as e:
try:
xlwb = xlapp.Workbooks.Open(xlfile)
except Exception as e:
print(e)
xlwb = None
return(xlwb)
\ No newline at end of file
import subprocess
import json
import datetime
import time
import codecs
import os
import signal
import sys #Get input argument
import pdb
from . import Server
import logging
import copy
#from .Settings import Settings
import importlib
from importlib import util
#Единый глобальный словарь (За основу взять из Settings.py)
global mGlobalDict
#Call Settings function from argv[1] file
################################################
lSubmoduleFunctionName = "Settings"
lFileFullPath = sys.argv[1]
lModuleName = (lFileFullPath.split("\\")[-1])[0:-3]
lTechSpecification = importlib.util.spec_from_file_location(lModuleName, lFileFullPath)
lTechModuleFromSpec = importlib.util.module_from_spec(lTechSpecification)
lTechSpecificationModuleLoader = lTechSpecification.loader.exec_module(lTechModuleFromSpec)
mGlobalDict = None
if lSubmoduleFunctionName in dir(lTechModuleFromSpec):
# Run SettingUpdate function in submodule
mGlobalDict = getattr(lTechModuleFromSpec, lSubmoduleFunctionName)()
#################################################
#mGlobalDict = Settings.Settings(sys.argv[1])
Server.mGlobalDict = mGlobalDict
#Инициализация настроечных параметров
lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>)
lDaemonStartDateTime=datetime.datetime.now()
#Инициализация сервера
lThreadServer = Server.RobotDaemonServer("ServerThread", mGlobalDict)
lThreadServer.start()
\ No newline at end of file
import json
from . import ExcelCom
import os
import sqlite3
import win32com.client
import time
import pythoncom
#Insert in DB
def SQLInsert(inRequest,inGlobalDict):
inResponseDict = inRequest.OpenRPAResponseDict
# Create result JSON
lResultJSON = {"Status": "OK", "ErrorMessage":"", "Result":[]}
#Set status code 200
inResponseDict["StatusCode"] = 200
try:
#Read the body
#ReadRequest
lInputJSON={}
if inRequest.headers.get('Content-Length') is not None:
lInputByteArrayLength = int(inRequest.headers.get('Content-Length'))
lInputByteArray=inRequest.rfile.read(lInputByteArrayLength)
#print(lInputByteArray.decode('utf8'))
#Превращение массива байт в объект
lInputJSON=json.loads(lInputByteArray.decode('utf8'))
########################################
conn = sqlite3.connect(inGlobalDict["SQLite"]["DBPath"])
c = conn.cursor()
# Loop for rows
for lRowItem in lInputJSON:
lRowResult={"Status": "OK", "ErrorMessage":""}
try:
my_dict = lRowItem["RowDict"]
# Insert a row of data
columns = ', '.join(my_dict.keys())
placeholders = ':'+', :'.join(my_dict.keys())
query = f'INSERT INTO {lRowItem["TableName"]} (%s) VALUES (%s)' % (columns, placeholders)
c.execute(query, my_dict)
except Exception as e:
lRowResult["Status"]="ERROR"
lRowResult["ErrorMessage"]=str(e)
finally:
lResultJSON["Result"].append(lRowResult)
# Save (commit) the changes
conn.commit()
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
except Exception as e:
lResultJSON["Status"]="ERROR"
lResultJSON["ErrorMessage"]=str(e)
finally:
########################################
# Send message back to client
message = json.dumps(lResultJSON)
print(message)
# Write content as utf-8 data
inResponseDict["Body"] = bytes(message, "utf8")
################################################
#Export SQLite to Excel
def SQLExportXLS(inRequest,inGlobalDict):
#Step 1 - read SQLite
conn = sqlite3.connect(inGlobalDict["SQLite"]["DBPath"])
c = conn.cursor()
# Loop for rows
# for lRowItem in lInputJSON:
# my_dict = lRowItem["RowDict"]
# # Insert a row of data
# columns = ', '.join(my_dict.keys())
# placeholders = ':'+', :'.join(my_dict.keys())
query = f'select * from Test'
#create data array
#row = range(0,10)
i = 0
data_array = []
for row in c.execute(query):
# use the cursor as an iterable
data_array.append(row)
i += 1
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
#step 2 - insert in XLS
pythoncom.CoInitialize()
#write the array to an excel file
#excel = win32com.client.Dispatch("Excel.Application")
excel = win32com.client.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
excel.DisplayAlerts = False
#excel.ScreenUpdating = False
#book = excel.Workbooks.Add()
#sheet = book.Worksheets(1)
#Read input JSON
lInputJSON={}
if inRequest.headers.get('Content-Length') is not None:
lInputByteArrayLength = int(inRequest.headers.get('Content-Length'))
lInputByteArray=inRequest.rfile.read(lInputByteArrayLength)
#print(lInputByteArray.decode('utf8'))
#Превращение массива байт в объект
lInputJSON=json.loads(lInputByteArray.decode('utf8'))
#Config
lOffsetRow = lInputJSON["OffsetRow"]
lOffsetCol = lInputJSON["OffsetCol"]
lXLSTemplatePath = lInputJSON["XLSTemplatePath"]
lXLSSheetName = lInputJSON["XLSSheetName"]
lXLSResultPath = lInputJSON["XLSResultPath"]
lXLSResultFlagSendInResponse = lInputJSON["XLSResultFlagSendInResponse"]
lXLSResultFlagDeleteAfterSend = lInputJSON["XLSResultFlagDeleteAfterSend"]
try:
#excel = win32com.client.gencache.EnsureDispatch('Excel.Application')
book = ExcelCom.OpenWorkbook(excel, lXLSTemplatePath)
sheet = book.Worksheets(lXLSSheetName)
excel.Visible = True
#single loop, writing a row to a range
#Logic
start = time.time()
row = 0
for line in data_array:
row += 1
sheet.Range(sheet.Cells(row+lOffsetRow,1+lOffsetCol), sheet.Cells(row+lOffsetRow, len(line)+lOffsetCol)).Value = line
if lXLSResultPath:
book.SaveAs(Filename = lXLSResultPath)
#excel.ScreenUpdating = True
except Exception as e:
print(e)
finally:
# RELEASES RESOURCES
sheet = None
book = None
excel.DisplayAlerts = True
excel.Quit()
excel = None
pythoncom.CoUninitialize()
#####################
#Step 3 - Send file content to client
#####################
if lXLSResultFlagSendInResponse and lXLSResultPath:
lFileObject = open(lXLSResultPath, "rb")
# Write content as utf-8 data
inRequest.OpenRPAResponseDict["Body"] = lFileObject.read()
# Закрыть файловый объект
lFileObject.close()
#####################
#Step 4 - Delete after send
#####################
if lXLSResultFlagDeleteAfterSend and lXLSResultPath:
if os.path.exists(lXLSResultPath):
os.remove(lXLSResultPath)
def SettingsUpdate(inGlobalConfiguration):
import os
import pyOpenRPA.Orchestrator
lOrchestratorFolder = "\\".join(pyOpenRPA.Orchestrator.__file__.split("\\")[:-1])
lURLList = \
[ #List of available URLs with the orchestrator server
#{
# "Method":"GET|POST",
# "URL": "/index", #URL of the request
# "MatchType": "", #"BeginWith|Contains|Equal|EqualCase",
# "ResponseFilePath": "", #Absolute or relative path
# "ResponseFolderPath": "", #Absolute or relative path
# "ResponseContentType": "", #HTTP Content-type
# "ResponseDefRequestGlobal": None #Function with str result
#}
#Orchestrator basic dependencies
{"Method":"POST", "URL": "/SQLInsert", "MatchType": "EqualCase", "ResponseDefRequestGlobal": SQLInsert, "ResponseContentType": "application/json"},
{"Method":"POST", "URL": "/SQLExportXLS.xlsx", "MatchType": "EqualCase", "ResponseDefRequestGlobal": SQLExportXLS, "ResponseContentType": "application/octet-stream"}
]
inGlobalConfiguration["Server"]["URLList"]=inGlobalConfiguration["Server"]["URLList"]+lURLList
return inGlobalConfiguration
\ No newline at end of file
r"""
The OpenRPA package (from UnicodeLabs)
"""
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
\ No newline at end of file
import sys
lFolderPath = "\\".join(__file__.split("\\")[:-3])
sys.path.insert(0, lFolderPath)
from pyOpenRPA.Tools.RobotDB import RobotDB
\ No newline at end of file
......@@ -3,7 +3,7 @@ r"""
The OpenRPA package (from UnicodeLabs)
"""
__version__ = 'v1.0.37'
__version__ = 'v1.0.39'
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
#from .Core import Robot
\ No newline at end of file
Metadata-Version: 2.1
Name: pyOpenRPA
Version: 1.0.37
Version: 1.0.39
Summary: First open source RPA platform for business
Home-page: https://gitlab.com/UnicodeLabs/OpenRPA
Author: Ivan Maslov
......
pyOpenRPA-1.0.37.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyOpenRPA-1.0.37.dist-info/METADATA,sha256=NvEs1xItXmuAnPaTzTs5kDpr6NhwdD4_WyFwvG9UTLo,3510
pyOpenRPA-1.0.37.dist-info/RECORD,,
pyOpenRPA-1.0.37.dist-info/WHEEL,sha256=qB97nP5e4MrOsXW5bIU5cUn_KSVr10EV0l-GCHG9qNs,97
pyOpenRPA-1.0.37.dist-info/top_level.txt,sha256=RPzwQXgYBRo_m5L3ZLs6Voh8aEkMeT29Xsul1w1qE0g,10
pyOpenRPA-1.0.39.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyOpenRPA-1.0.39.dist-info/METADATA,sha256=KSr_y71FFd5y4tYQHnz80Pj_96WCYKwWbW5eK0hd4KM,3510
pyOpenRPA-1.0.39.dist-info/RECORD,,
pyOpenRPA-1.0.39.dist-info/WHEEL,sha256=qB97nP5e4MrOsXW5bIU5cUn_KSVr10EV0l-GCHG9qNs,97
pyOpenRPA-1.0.39.dist-info/top_level.txt,sha256=RPzwQXgYBRo_m5L3ZLs6Voh8aEkMeT29Xsul1w1qE0g,10
pyOpenRPA/Orchestrator/Orchestrator.py,sha256=UKp7eqvWDM91kYLwl2mo0UB8Pw-qu8eJCsR9NEXD1aU,6436
pyOpenRPA/Orchestrator/Processor.py,sha256=HQQyOVX-d5vPO-YULyTxVOtXtUMfvpAaSVO4xXxaKVI,9107
pyOpenRPA/Orchestrator/Server.py,sha256=aWDecl4_UUU00YG-pOXxyL7IvN5NK3efABt92y6M2kg,22136
pyOpenRPA/Orchestrator/Processor.py,sha256=kmGNIqe6AZMSrzCt1QlonEy58ecFeLunjo8AeRMsufU,11091
pyOpenRPA/Orchestrator/Server.py,sha256=QQK1rMZSg-pL9pJ059AoxIHHj4aFr1OWivdOEKPh9cs,22026
pyOpenRPA/Orchestrator/ServerSettings.py,sha256=jOXJTLwg8cJx6D-rN8J4dn5RCb2nepAhCH4F9hYVUdM,4912
pyOpenRPA/Orchestrator/Timer.py,sha256=FQZ3y6G9d47Ybx7RewzePKQV77H4gCkx5SaeFVlsuhc,2095
pyOpenRPA/Orchestrator/Web/Index.xhtml,sha256=su4tsDD_ZMbQz6Tbmqj55SM0ZZxuQw9tfPcytaB8wzs,32953
......@@ -195,7 +195,7 @@ pyOpenRPA/Robot/Clipboard.py,sha256=q76X8L21zJwcwdoJJNPeCEwAV30xS6ylHP1WwvtxoWI,
pyOpenRPA/Robot/OrchestratorConnector.py,sha256=Fihxz-jH9M4VakXEE0SZ0Vo9tLEQk8Tcg_C4HoH45gI,20037
pyOpenRPA/Robot/SettingsTemplate.py,sha256=Rp5XPeV2I4tCS2uf4Zkqm_ERJ6pZMg4-e5_lMqGJYLk,1453
pyOpenRPA/Robot/Test.py,sha256=qXr990nXiFZX5SNv6QN9GLb_U4HZRmJnbZR2qSnwilY,2878
pyOpenRPA/Robot/UIDesktop.py,sha256=MWdWr0dZpk1PL1rsD91q6_8v687CSDBx1_T7IuHd3-E,77473
pyOpenRPA/Robot/UIDesktop.py,sha256=3I2bllTDvR9d10O2ltkjoKmYw34wkkDAZfPlRpwbj30,77476
pyOpenRPA/Robot/Utils/JSONNormalize.py,sha256=aIuVzuZDazhxkCOzoOjfhHVz66mp2FWdfPv5E7KWF5Y,3890
pyOpenRPA/Robot/Utils/ProcessBitness.py,sha256=WlKL-DklGaoTnchtapOTM_ydxSB4yOeo9lcG3zr2VME,4524
pyOpenRPA/Robot/Utils/ProcessCommunicator.py,sha256=8GfmLnOvAdosmt7YNT86uEV9cjhKippssCX62wOMJwM,8039
......@@ -235,6 +235,18 @@ pyOpenRPA/Studio/__pycache__/Studio.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/ValueVerify.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Studio/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/ExcelCom.py,sha256=hp0dvXOEC7Au00ueh7pqxkdixV-PC-km7tCt-wRunYs,343
pyOpenRPA/Tools/RobotDB/RobotDB.py,sha256=DZSb17fiCAYLdNVTLFJ7nTbQhk29PjzxE9OL6ydCDcI,1645
pyOpenRPA/Tools/RobotDB/Server.py,sha256=RO4Rj5-hmrRB41XKm4CrSFtauzKj3wNq4VmgcxhseeY,19838
pyOpenRPA/Tools/RobotDB/ServerSettings.py,sha256=5p9JwrpKHh68oVHIWazTajB6AOfzeapARbvGcJOFmNc,7406
pyOpenRPA/Tools/RobotDB/__init__.py,sha256=qVH8fEPgXk54rmy-ol0PnT8GF5OlGE0a8mExwJ4tFqY,124
pyOpenRPA/Tools/RobotDB/__main__.py,sha256=w9sXIF4r_PeWJjHJutTuH8DSYpXxpgcAN0KUOjiJ6PI,140
pyOpenRPA/Tools/RobotDB/__pycache__/ExcelCom.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/RobotDB.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/Server.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/ServerSettings.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotDB/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotRDPActive/Connector.py,sha256=qU5SXwHgQU177MjqEHyOwJDLAcSVnIkKKw76iD09J1w,7275
pyOpenRPA/Tools/RobotRDPActive/Monitor.py,sha256=H7ciateTh-hml8z69EYZjYgqdTZGkDRtnFwuYnytrCw,3278
pyOpenRPA/Tools/RobotRDPActive/Template.rdp,sha256=qPCLkjzTdYKURK7nRApkPUjRuS4K20vDPj9DIUNSSkE,2392
......@@ -255,5 +267,5 @@ pyOpenRPA/Tools/RobotScreenActive/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/Tools/RobotScreenActive/__pycache__/__main__.cpython-37.pyc,,
pyOpenRPA/Tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
pyOpenRPA/Tools/__pycache__/__init__.cpython-37.pyc,,
pyOpenRPA/__init__.py,sha256=32Po3gFALn9l6ft6LTFVJBkBj-1p5hP83AVcQ_FTa0s,175
pyOpenRPA/__init__.py,sha256=iZp06tUV8Mw7GGdUcuW_faV4YaQEJa_n5BqxOl0cwx8,175
pyOpenRPA/__pycache__/__init__.cpython-37.pyc,,
......@@ -7,6 +7,7 @@ import sys
import subprocess
import copy
import importlib
import psutil
#Input arg
# [
# {
......@@ -38,6 +39,13 @@ import importlib
#
# },
# {
# "Type":"ProcessStartIfTurnedOff",
# "CheckTaskName":"", #Check if current task name is not active (then start process),
# "Path":"",
# "ArgList":[]
#
# },
# {
# "Type":"ProcessStop",
# "Name":"",
# "FlagForce":True,
......@@ -71,6 +79,7 @@ def Activity(inActivity):
inActivity["DateTimeUTCStringStart"] = datetime.datetime.strftime(datetime.datetime.now(),"%Y-%m-%dT%H:%M:%S.%f")
#Alias (compatibility)
lItem = inActivity
lCurrentDateTime = datetime.datetime.now()
###########################################################
#Обработка запроса на отправку команды на удаленную машину
###########################################################
......@@ -138,11 +147,33 @@ def Activity(inActivity):
#Вид активности - запуск процесса
#Запись в массив отработанных активностей
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["activityType"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["processPath"], "activityStartDateTime":str(lCurrentDateTime)})
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Path"], "activityStartDateTime":str(lCurrentDateTime)})
#Запустить процесс
lItemArgs=[lItem["processPath"]]
lItemArgs.extend(lItem["processArgs"])
lItemArgs=[lItem["Path"]]
lItemArgs.extend(lItem["ArgList"])
subprocess.Popen(lItemArgs,shell=True)
#####################################
#ProcessStartIfTurnedOff
#####################################
if lItem["Type"]=="ProcessStartIfTurnedOff":
#Check if process running
#remove .exe from Taskname if exists
lCheckTaskName = lItem["CheckTaskName"]
if len(lCheckTaskName)>4:
if lCheckTaskName[-4:].upper() != ".EXE":
lCheckTaskName = lCheckTaskName+".exe"
else:
lCheckTaskName = lCheckTaskName+".exe"
#Check if process exist
if not CheckIfProcessRunning(lCheckTaskName):
#Вид активности - запуск процесса
#Запись в массив отработанных активностей
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Path"], "activityStartDateTime":str(lCurrentDateTime)})
#Запустить процесс
lItemArgs=[lItem["Path"]]
lItemArgs.extend(lItem["ArgList"])
subprocess.Popen(lItemArgs,shell=True)
#################################
#ProcessStop
#################################
......@@ -150,7 +181,7 @@ def Activity(inActivity):
#Вид активности - остановка процесса
#часовой пояс пока не учитываем
#Сформировать команду на завершение
lActivityCloseCommand='taskkill /im '+lItem["processName"]
lActivityCloseCommand='taskkill /im '+lItem["Name"]
#TODO Сделать безопасную обработку,если параметра нет в конфигурации
if lItem.get('FlagForce',False):
lActivityCloseCommand+=" /F"
......@@ -158,7 +189,7 @@ def Activity(inActivity):
if lItem.get('User',"")!="":
lActivityCloseCommand+=f' /fi "username eq {lItem["User"]}"'
#Лог
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["activityType"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["processName"], "activityStartDateTime":str(lCurrentDateTime)})
mGlobalDict["Processor"]["LogList"].append({"activityType":lItem["Type"], "activityDateTime":str(lActivityDateTime), "processPath":lItem["Name"], "activityStartDateTime":str(lCurrentDateTime)})
#Завершить процесс
os.system(lActivityCloseCommand)
#################################
......@@ -213,4 +244,18 @@ def ActivityListOrDict(inActivityListOrDict):
return lResult
if type(inActivityListOrDict)==dict:
#Dict activity
return Activity(inActivityListOrDict)
\ No newline at end of file
return Activity(inActivityListOrDict)
def CheckIfProcessRunning(processName):
'''
Check if there is any running process that contains the given name processName.
'''
#Iterate over the all the running process
for proc in psutil.process_iter():
try:
# Check if process name contains the given name string.
if processName.lower() in proc.name().lower():
return True
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return False;
\ No newline at end of file
......@@ -425,8 +425,6 @@ class RobotDaemonServer(Thread):
#httpd = HTTPServer(server_address, testHTTPServer_RequestHandler)
# Logging
mGlobalDict["Logger"].info(f"Server init. Listen URL: {inServerAddress}, Listen port: {inPort}")
# Запуск адреса в браузере
os.system("explorer http://127.0.0.1:8081")
#httpd.serve_forever()
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
#print('Starting server, use <Ctrl-C> to stop')
......
......@@ -1208,7 +1208,7 @@ def UIOSelector_Highlight(inUIOSelector):
UIO_Highlight(UIOSelector_Get_UIO(inUIOSelector))
else:
# Run function from other process with help of PIPE
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Exist_Bool",
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Highlight",
"ArgumentList": [inUIOSelector],
"ArgumentDict": {}}
# Отправить запрос в дочерний процесс, который отвечает за работу с Windows окнами
......@@ -1233,7 +1233,7 @@ def UIOSelector_FocusHighlight(inUIOSelector):
UIO_FocusHighlight(UIOSelector_Get_UIO(inUIOSelector))
else:
# Run function from other process with help of PIPE
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_Exist_Bool",
lPIPEResuestDict = {"ModuleName": "UIDesktop", "ActivityName": "UIOSelector_FocusHighlight",
"ArgumentList": [inUIOSelector],
"ArgumentDict": {}}
# Отправить запрос в дочерний процесс, который отвечает за работу с Windows окнами
......
import win32com.client as win32
def OpenWorkbook(xlapp, xlfile):
try:
xlwb = xlapp.Workbooks(xlfile)
except Exception as e:
try:
xlwb = xlapp.Workbooks.Open(xlfile)
except Exception as e:
print(e)
xlwb = None
return(xlwb)
\ No newline at end of file
import subprocess
import json
import datetime
import time
import codecs
import os
import signal
import sys #Get input argument
import pdb
from . import Server
import logging
import copy
#from .Settings import Settings
import importlib
from importlib import util
#Единый глобальный словарь (За основу взять из Settings.py)
global mGlobalDict
#Call Settings function from argv[1] file
################################################
lSubmoduleFunctionName = "Settings"
lFileFullPath = sys.argv[1]
lModuleName = (lFileFullPath.split("\\")[-1])[0:-3]
lTechSpecification = importlib.util.spec_from_file_location(lModuleName, lFileFullPath)
lTechModuleFromSpec = importlib.util.module_from_spec(lTechSpecification)
lTechSpecificationModuleLoader = lTechSpecification.loader.exec_module(lTechModuleFromSpec)
mGlobalDict = None
if lSubmoduleFunctionName in dir(lTechModuleFromSpec):
# Run SettingUpdate function in submodule
mGlobalDict = getattr(lTechModuleFromSpec, lSubmoduleFunctionName)()
#################################################
#mGlobalDict = Settings.Settings(sys.argv[1])
Server.mGlobalDict = mGlobalDict
#Инициализация настроечных параметров
lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>)
lDaemonStartDateTime=datetime.datetime.now()
#Инициализация сервера
lThreadServer = Server.RobotDaemonServer("ServerThread", mGlobalDict)
lThreadServer.start()
\ No newline at end of file
import json
from . import ExcelCom
import os
import sqlite3
import win32com.client
import time
import pythoncom
#Insert in DB
def SQLInsert(inRequest,inGlobalDict):
inResponseDict = inRequest.OpenRPAResponseDict
# Create result JSON
lResultJSON = {"Status": "OK", "ErrorMessage":"", "Result":[]}
#Set status code 200
inResponseDict["StatusCode"] = 200
try:
#Read the body
#ReadRequest
lInputJSON={}
if inRequest.headers.get('Content-Length') is not None:
lInputByteArrayLength = int(inRequest.headers.get('Content-Length'))
lInputByteArray=inRequest.rfile.read(lInputByteArrayLength)
#print(lInputByteArray.decode('utf8'))
#Превращение массива байт в объект
lInputJSON=json.loads(lInputByteArray.decode('utf8'))
########################################
conn = sqlite3.connect(inGlobalDict["SQLite"]["DBPath"])
c = conn.cursor()
# Loop for rows
for lRowItem in lInputJSON:
lRowResult={"Status": "OK", "ErrorMessage":""}
try:
my_dict = lRowItem["RowDict"]
# Insert a row of data
columns = ', '.join(my_dict.keys())
placeholders = ':'+', :'.join(my_dict.keys())
query = f'INSERT INTO {lRowItem["TableName"]} (%s) VALUES (%s)' % (columns, placeholders)
c.execute(query, my_dict)
except Exception as e:
lRowResult["Status"]="ERROR"
lRowResult["ErrorMessage"]=str(e)
finally:
lResultJSON["Result"].append(lRowResult)
# Save (commit) the changes
conn.commit()
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
except Exception as e:
lResultJSON["Status"]="ERROR"
lResultJSON["ErrorMessage"]=str(e)
finally:
########################################
# Send message back to client
message = json.dumps(lResultJSON)
print(message)
# Write content as utf-8 data
inResponseDict["Body"] = bytes(message, "utf8")
################################################
#Export SQLite to Excel
def SQLExportXLS(inRequest,inGlobalDict):
#Step 1 - read SQLite
conn = sqlite3.connect(inGlobalDict["SQLite"]["DBPath"])
c = conn.cursor()
# Loop for rows
# for lRowItem in lInputJSON:
# my_dict = lRowItem["RowDict"]
# # Insert a row of data
# columns = ', '.join(my_dict.keys())
# placeholders = ':'+', :'.join(my_dict.keys())
query = f'select * from Test'
#create data array
#row = range(0,10)
i = 0
data_array = []
for row in c.execute(query):
# use the cursor as an iterable
data_array.append(row)
i += 1
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
#step 2 - insert in XLS
pythoncom.CoInitialize()
#write the array to an excel file
#excel = win32com.client.Dispatch("Excel.Application")
excel = win32com.client.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True
excel.DisplayAlerts = False
#excel.ScreenUpdating = False
#book = excel.Workbooks.Add()
#sheet = book.Worksheets(1)
#Read input JSON
lInputJSON={}
if inRequest.headers.get('Content-Length') is not None:
lInputByteArrayLength = int(inRequest.headers.get('Content-Length'))
lInputByteArray=inRequest.rfile.read(lInputByteArrayLength)
#print(lInputByteArray.decode('utf8'))
#Превращение массива байт в объект
lInputJSON=json.loads(lInputByteArray.decode('utf8'))
#Config
lOffsetRow = lInputJSON["OffsetRow"]
lOffsetCol = lInputJSON["OffsetCol"]
lXLSTemplatePath = lInputJSON["XLSTemplatePath"]
lXLSSheetName = lInputJSON["XLSSheetName"]
lXLSResultPath = lInputJSON["XLSResultPath"]
lXLSResultFlagSendInResponse = lInputJSON["XLSResultFlagSendInResponse"]
lXLSResultFlagDeleteAfterSend = lInputJSON["XLSResultFlagDeleteAfterSend"]
try:
#excel = win32com.client.gencache.EnsureDispatch('Excel.Application')
book = ExcelCom.OpenWorkbook(excel, lXLSTemplatePath)
sheet = book.Worksheets(lXLSSheetName)
excel.Visible = True
#single loop, writing a row to a range
#Logic
start = time.time()
row = 0
for line in data_array:
row += 1
sheet.Range(sheet.Cells(row+lOffsetRow,1+lOffsetCol), sheet.Cells(row+lOffsetRow, len(line)+lOffsetCol)).Value = line
if lXLSResultPath:
book.SaveAs(Filename = lXLSResultPath)
#excel.ScreenUpdating = True
except Exception as e:
print(e)
finally:
# RELEASES RESOURCES
sheet = None
book = None
excel.DisplayAlerts = True
excel.Quit()
excel = None
pythoncom.CoUninitialize()
#####################
#Step 3 - Send file content to client
#####################
if lXLSResultFlagSendInResponse and lXLSResultPath:
lFileObject = open(lXLSResultPath, "rb")
# Write content as utf-8 data
inRequest.OpenRPAResponseDict["Body"] = lFileObject.read()
# Закрыть файловый объект
lFileObject.close()
#####################
#Step 4 - Delete after send
#####################
if lXLSResultFlagDeleteAfterSend and lXLSResultPath:
if os.path.exists(lXLSResultPath):
os.remove(lXLSResultPath)
def SettingsUpdate(inGlobalConfiguration):
import os
import pyOpenRPA.Orchestrator
lOrchestratorFolder = "\\".join(pyOpenRPA.Orchestrator.__file__.split("\\")[:-1])
lURLList = \
[ #List of available URLs with the orchestrator server
#{
# "Method":"GET|POST",
# "URL": "/index", #URL of the request
# "MatchType": "", #"BeginWith|Contains|Equal|EqualCase",
# "ResponseFilePath": "", #Absolute or relative path
# "ResponseFolderPath": "", #Absolute or relative path
# "ResponseContentType": "", #HTTP Content-type
# "ResponseDefRequestGlobal": None #Function with str result
#}
#Orchestrator basic dependencies
{"Method":"POST", "URL": "/SQLInsert", "MatchType": "EqualCase", "ResponseDefRequestGlobal": SQLInsert, "ResponseContentType": "application/json"},
{"Method":"POST", "URL": "/SQLExportXLS.xlsx", "MatchType": "EqualCase", "ResponseDefRequestGlobal": SQLExportXLS, "ResponseContentType": "application/octet-stream"}
]
inGlobalConfiguration["Server"]["URLList"]=inGlobalConfiguration["Server"]["URLList"]+lURLList
return inGlobalConfiguration
\ No newline at end of file
r"""
The OpenRPA package (from UnicodeLabs)
"""
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
\ No newline at end of file
import sys
lFolderPath = "\\".join(__file__.split("\\")[:-3])
sys.path.insert(0, lFolderPath)
from pyOpenRPA.Tools.RobotDB import RobotDB
\ No newline at end of file
......@@ -3,7 +3,7 @@ r"""
The OpenRPA package (from UnicodeLabs)
"""
__version__ = 'v1.0.37'
__version__ = 'v1.0.39'
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
#from .Core import Robot
\ No newline at end of file
......@@ -3,7 +3,7 @@ r"""
The OpenRPA package (from UnicodeLabs)
"""
__version__ = 'v1.0.38'
__version__ = 'v1.0.39'
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'
#from .Core import Robot
\ No newline at end of file
......@@ -2,7 +2,7 @@ import psutil
import datetime
import logging
import os
import pdb
#RobotDB settings
def Settings():
import os
......@@ -89,6 +89,7 @@ def Settings():
import pdb
#lFunction to call in subfiles
lSubmoduleFunctionName = "SettingsUpdate"
#pdb.set_trace()
#lSettingsPath = os.path.join(inSettingsFolderPath, "Settings")
lSettingsPath = "\\".join(os.path.join(os.getcwd(),__file__).split("\\")[:-1])
#lSettingsPath = os.path.join(os.getcwd(), "Settings")
......
import json
import os
import time
import datetime
#ControlPanelDict
from desktopmagic.screengrab_win32 import (
getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage,
getRectAsImage, getDisplaysAsImages)
############################################
inScreenshotFolder="Screenshots"
def SaveScreenshot(inFilePath):
# grab fullscreen
# Save the entire virtual screen as a PNG
lScreenshot = getScreenAsImage()
lScreenshot.save(inFilePath, format='png')
# lScreenshot = ScreenshotSecondScreen.grab_screen()
# save image file
# lScreenshot.save('screenshot.png')
# Сохранить файл на диск
while True:
try:
SaveScreenshot(os.path.abspath(os.path.join(inScreenshotFolder,f'Scr_{datetime.datetime.now().strftime("%Y_%m_%d__%H_%M_%S")}.png')))
except Exception as e:
pass
time.sleep(3)
\ No newline at end of file
cd %~dp0
python-3.7.2.amd64\python.exe "TechScreenSpy.py"
pause >nul
\ No newline at end of file
cd %~dp0
python-3.7.2.amd64\pythonw.exe "TechScreenSpy.py"
pause >nul
\ No newline at end of file
#########Get settings############
gSettings= None #Init variable
import Settings #Tool settings
gSettings = Settings.SettingsGet()
##################################
import requests #Lib for HTTP requests
#Create HTTP session
lSession = requests.Session()
lResponse = None
#If GET
if gSettings["Method"].upper()=="GET":
lResponse = lSession.get(gSettings["URL"], headers=gSettings["Headers"], cookies=gSettings["Cookies"], verify=False, json = gSettings["JSON"])
#If POST
elif gSettings["Method"].upper()=="POST":
lResponse = lSession.post(gSettings["URL"], headers=gSettings["Headers"], cookies=gSettings["Cookies"], verify=False, json = gSettings["JSON"])
print(f'SessionObject: {lResponse}, Body: {lResponse.text}')
#Debug section
while True:
lCommand = input("Write Python cmd:") #Wait for python command
exec(lCommand) #Execute the command
\ No newline at end of file
cd %~dp0
..\..\Resources\OpenRPA\v1.0.38\python-3.7.2.amd64\python.exe "Main.py"
pause >nul
\ No newline at end of file
import json
def SettingsGet():
#Init config
lResult = {
"URL":"http://localhost:8081/SQLInsert", #Server host, example "http://localhost" Without / in the end
"Method":"POST", #Method to send HTTP (GET, POST...)
"Headers":{}, #Dictionary
"Cookies":{}, #Dictionary
"JSON":[{"TableName":"Test", "RowDict":{"Name":"Name1","Description":"DescTest", "Money":100, "Date":"01.01.2020"}}] #JSON data
}
return lResult
\ No newline at end of file