@ -1,20 +1,21 @@
import psutil
import psutil
import datetime
import datetime
import logging
import logging
import os
lProcessName = " OpenRPA_RobotRDPActive.exe "
lStartFilePath = os . path . join ( os . getcwd ( ) , " .. \\ Utils \\ RobotScreenActive \\ pyOpenRPA.Tools.RobotScreenActive_x64.cmd " )
def RenderRobotRDPActive ( inGlobalConfiguration ) :
def RenderRobotRDPActive ( inGlobalConfiguration ) :
#Subheader Variants
#Subheader Variants
lSubheaderRunTrueText = " Состояние : <span style=\" color:green \" >Turned on</span> "
lSubheaderRunTrueText = " State : <span style=\" color:green \" >Turned on</span> "
lSubheaderRunFalseText = " Состояние : <span style=\" color:red \" >Turned off</span> "
lSubheaderRunFalseText = " State : <span style=\" color:red \" >Turned off</span> "
#Run button
#Run button
#Такое большое количество слэшей связано с тем, что этот текст отправляется сначала в браузер, рендерится там, а потом отправляется на процессор оркестратора
#Такое большое количество слэшей связано с тем, что этот текст отправляется сначала в браузер, рендерится там, а потом отправляется на процессор оркестратора
import os
lRobotRDPActivePath = lStartFilePath
lRobotRDPActivePath = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , " .. \\ .. \\ Utils \\ RobotRDPActive \\ pyOpenRPA.Tools.RobotRDPActive_x64.cmd " )
lOnClickRunButton = f " mGlobal.Controller.CMDRunText( ' { lRobotRDPActivePath } ' ); "
lOnClickRunButton = f " mGlobal.Controller.CMDRunText( ' { lRobotRDPActivePath } ' ); "
#Safe turn off
#Safe turn off
lOnClickSafeTurnOff = " mGlobal.Processor.ServerValueSet([ ' Storage ' , ' RobotRDPActive ' , ' OrchestratorToRobotResetStorage ' , ' SafeTurnOff ' ],true); "
lOnClickSafeTurnOff = " mGlobal.Processor.ServerValueSet([ ' Storage ' , ' RobotRDPActive ' , ' OrchestratorToRobotResetStorage ' , ' SafeTurnOff ' ],true); "
#Force close button
#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
#Result template
lResultDict = {
lResultDict = {
" HeaderLeftText " : " Keep active RDP sessions " ,
" HeaderLeftText " : " Keep active RDP sessions " ,
@ -24,15 +25,14 @@ def RenderRobotRDPActive(inGlobalConfiguration):
" BodyKeyValueList " : [
" BodyKeyValueList " : [
{ " Key " : " Session list " , " Value " : " " }
{ " Key " : " Session list " , " Value " : " " }
] ,
] ,
" FooterText " : " Дата изменения : 9:38:00 09.10.2019" ,
" FooterText " : " Last update : 9:38:00 09.10.2019" ,
" FooterButtonX2List " : [
" FooterButtonX2List " : [
{ " Text " : " Turn on " , " Color " : " green " , " Link " : " " , " OnClick " : lOnClickRunButton . replace ( " \\ " , " \\ \\ " ) } ,
{ " Text " : " Turn on " , " Color " : " green " , " Link " : " " , " OnClick " : lOnClickRunButton . replace ( " \\ " , " \\ \\ " ) } ,
{ " Text " : " Safe turn off " , " Color " : " orange " , " Link " : " " , " OnClick " : lOnClickSafeTurnOff . replace ( " \\ " , " \\ \\ " ) }
{ " Text " : " Safe turn off " , " Color " : " orange " , " Link " : " " , " OnClick " : lOnClickSafeTurnOff . replace ( " \\ " , " \\ \\ " ) }
] ,
] ,
" FooterButtonX1List " : [
" FooterButtonX1List " : [
{ " Text " : " Kill " , " Color " : " red " , " Link " : " " , " OnClick " : lOnClickForceCloseButton . replace ( " \\ " , " \\ \\ " ) }
{ " Text " : " Kill " , " Color " : " red " , " Link " : " " , " OnClick " : lOnClickForceCloseButton . replace ( " \\ " , " \\ \\ " ) }
] ,
]
" Data " : inGlobalConfiguration [ " Storage " ]
}
}
#Read RDPList
#Read RDPList
lRDPList = inGlobalConfiguration . get ( " Storage " , { } ) . get ( " RobotRDPActive " , { } ) . get ( " RobotToOrchestratorStorage " , { } ) . get ( " RDPList " , [ ] )
lRDPList = inGlobalConfiguration . get ( " Storage " , { } ) . get ( " RobotRDPActive " , { } ) . get ( " RobotToOrchestratorStorage " , { } ) . get ( " RDPList " , [ ] )
@ -47,7 +47,7 @@ def RenderRobotRDPActive(inGlobalConfiguration):
if CheckIfProcessRunning ( " OpenRPA_RobotRDPActive " ) :
if CheckIfProcessRunning ( " OpenRPA_RobotRDPActive " ) :
lResultDict [ " SubheaderText " ] = lSubheaderRunTrueText
lResultDict [ " SubheaderText " ] = lSubheaderRunTrueText
#Process not running
#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
return lResultDict
def CheckIfProcessRunning ( processName ) :
def CheckIfProcessRunning ( processName ) :