diff --git a/Orchestrator/Settings/ControlPanel_RobotRDPActive.py b/Orchestrator/Settings/ControlPanel_RobotRDPActive.py
index 3dba1b04..2da45ece 100644
--- a/Orchestrator/Settings/ControlPanel_RobotRDPActive.py
+++ b/Orchestrator/Settings/ControlPanel_RobotRDPActive.py
@@ -1,20 +1,21 @@
import psutil
import datetime
import logging
-
+import os
+lProcessName = "OpenRPA_RobotRDPActive.exe"
+lStartFilePath = os.path.join(os.getcwd(), "..\\Utils\\RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd")
def RenderRobotRDPActive(inGlobalConfiguration):
#Subheader Variants
- lSubheaderRunTrueText="Состояние: Turned on"
- lSubheaderRunFalseText="Состояние: Turned off"
+ lSubheaderRunTrueText="State: Turned on"
+ lSubheaderRunFalseText="State: Turned off"
#Run button
#Такое большое количество слэшей связано с тем, что этот текст отправляется сначала в браузер, рендерится там, а потом отправляется на процессор оркестратора
- import os
- lRobotRDPActivePath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..\\..\\Utils\\RobotRDPActive\\pyOpenRPA.Tools.RobotRDPActive_x64.cmd")
+ lRobotRDPActivePath = lStartFilePath
lOnClickRunButton=f"mGlobal.Controller.CMDRunText('{lRobotRDPActivePath}');"
#Safe turn off
lOnClickSafeTurnOff = "mGlobal.Processor.ServerValueSet(['Storage','RobotRDPActive','OrchestratorToRobotResetStorage','SafeTurnOff'],true);"
#Force close button
- lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im OpenRPA_RobotRDPActive.exe');"
+ lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im {lProcessName}.exe');"
#Result template
lResultDict={
"HeaderLeftText":"Keep active RDP sessions",
@@ -24,15 +25,14 @@ def RenderRobotRDPActive(inGlobalConfiguration):
"BodyKeyValueList":[
{"Key":"Session list","Value":""}
],
- "FooterText":"Дата изменения: 9:38:00 09.10.2019",
+ "FooterText":"Last update: 9:38:00 09.10.2019",
"FooterButtonX2List":[
{"Text":"Turn on", "Color":"green", "Link":"", "OnClick": lOnClickRunButton.replace("\\","\\\\")},
{"Text":"Safe turn off", "Color":"orange", "Link":"", "OnClick": lOnClickSafeTurnOff.replace("\\","\\\\")}
],
"FooterButtonX1List":[
{"Text":"Kill", "Color":"red", "Link":"", "OnClick": lOnClickForceCloseButton.replace("\\","\\\\")}
- ],
- "Data":inGlobalConfiguration["Storage"]
+ ]
}
#Read RDPList
lRDPList = inGlobalConfiguration.get("Storage",{}).get("RobotRDPActive",{}).get("RobotToOrchestratorStorage",{}).get("RDPList",[])
@@ -47,7 +47,7 @@ def RenderRobotRDPActive(inGlobalConfiguration):
if CheckIfProcessRunning("OpenRPA_RobotRDPActive"):
lResultDict["SubheaderText"]=lSubheaderRunTrueText
#Process not running
- lResultDict["FooterText"]=f'Дата обновления: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}'
+ lResultDict["FooterText"]=f'Last update: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}'
return lResultDict
def CheckIfProcessRunning(processName):
diff --git a/Orchestrator/Settings/ControlPanel_RobotScreenActive.py b/Orchestrator/Settings/ControlPanel_RobotScreenActive.py
new file mode 100644
index 00000000..ebfe0973
--- /dev/null
+++ b/Orchestrator/Settings/ControlPanel_RobotScreenActive.py
@@ -0,0 +1,60 @@
+import psutil
+import datetime
+import logging
+import os
+#DEFINITIONS
+lProcessName = "OpenRPA_RobotScreenActive.exe"
+lStartFilePath = os.path.join(os.getcwd(), "..\\Utils\\RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd")
+def RenderRobotScreenActive(inGlobalConfiguration):
+ #Subheader Variants
+ lSubheaderRunTrueText="State: Turned on"
+ lSubheaderRunFalseText="State: Turned off"
+ #Run button
+ #Такое большое количество слэшей связано с тем, что этот текст отправляется сначала в браузер, рендерится там, а потом отправляется на процессор оркестратора
+ import os
+ lRobotScreenActivePath = lStartFilePath
+ lOnClickRunButton=f"mGlobal.Controller.CMDRunText('{lRobotScreenActivePath}');"
+ #Force close button
+ lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im {lProcessName}');"
+ #Result template
+ lResultDict={
+ "HeaderLeftText":"Keep active screen session",
+ "HeaderRightText":"Tech",
+ "DataStorageKey":"RobotScreenActive", #Use key for set current dict in mGlobal.DataStorage["DtaaStorageKey"] on client side
+ "SubheaderText":lSubheaderRunFalseText,
+ "BodyKeyValueList":[
+ ],
+ "FooterText":"Last update: 9:38:00 09.10.2019",
+ "FooterButtonX2List":[
+ {"Text":"Turn on", "Color":"green", "Link":"", "OnClick": lOnClickRunButton.replace("\\","\\\\")}
+ ],
+ "FooterButtonX1List":[
+ {"Text":"Kill", "Color":"red", "Link":"", "OnClick": lOnClickForceCloseButton.replace("\\","\\\\")}
+ ]
+ }
+ #Check if process running
+ if CheckIfProcessRunning("OpenRPA_RobotScreenActive"):
+ lResultDict["SubheaderText"]=lSubheaderRunTrueText
+ #Process not running
+ lResultDict["FooterText"]=f'Last update: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}'
+ return lResultDict
+
+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;
+
+#Orchestrator settings
+def SettingsUpdate(inDict):
+ #Add RobotRDPActive in control panel
+ inDict["ControlPanelDict"]["RobotList"].append({"RenderFunction": RenderRobotScreenActive})
+ return inDict
\ No newline at end of file
diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_RobotScreenActive.exe b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_RobotScreenActive.exe
new file mode 100644
index 00000000..66a6265c
Binary files /dev/null and b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_RobotScreenActive.exe differ
diff --git a/Utils/RobotScreenActive/pyOpenRPA.Tools.RobotScreenActive_x64.cmd b/Utils/RobotScreenActive/pyOpenRPA.Tools.RobotScreenActive_x64.cmd
index b9ccc902..1944fa1e 100644
--- a/Utils/RobotScreenActive/pyOpenRPA.Tools.RobotScreenActive_x64.cmd
+++ b/Utils/RobotScreenActive/pyOpenRPA.Tools.RobotScreenActive_x64.cmd
@@ -1,3 +1,4 @@
cd %~dp0..\..\Sources
-..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe -m pyOpenRPA.Tools.RobotScreenActive
+copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPA_RobotScreenActive.exe
+..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPA_RobotScreenActive.exe -m pyOpenRPA.Tools.RobotScreenActive
pause >nul
\ No newline at end of file