@ -1,6 +1,7 @@
import json , os
import copy
from inspect import signature # For detect count of def args
from . import __Orchestrator__
#ControlPanelDict
from desktopmagic . screengrab_win32 import (
getDisplayRects , saveScreenToBmp , saveRectToBmp , getScreenAsImage ,
@ -257,6 +258,7 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict):
# Add activity item or activity list to the processor queue
# Body is Activity item or Activity List
def pyOpenRPA_Processor ( inRequest , inGSettings ) :
lL = inGSettings [ " Logger " ]
# Recieve the data
lValueStr = None
if inRequest . headers . get ( ' Content-Length ' ) is not None :
@ -266,12 +268,32 @@ def pyOpenRPA_Processor(inRequest, inGSettings):
lInput = json . loads ( lInputByteArray . decode ( ' utf8 ' ) )
# If list - operator plus
if type ( lInput ) is list :
# Logging info about processor activity if not SuperToken ()
if not __Orchestrator__ . WebUserIsSuperToken ( inRequest = inRequest , inGSettings = inGSettings ) :
lActivityTypeListStr = " "
try :
for lActivityItem in lInput :
lActivityTypeListStr + = f " { lActivityItem [ ' Def ' ] } ; "
except Exception as e :
lActivityTypeListStr = " Has some error with Activity Type read "
if lL : lL . info ( f " ServerSettings.pyOpenRPA_Processor. User activity from web. Domain: { inRequest . OpenRPA [ ' Domain ' ] } , Username: { inRequest . OpenRPA [ ' User ' ] } , ActivityType: { lActivityTypeListStr } " )
# Append in list
inGSettings [ " ProcessorDict " ] [ " ActivityList " ] + = lInput
else :
# Logging info about processor activity if not SuperToken ()
if not __Orchestrator__ . WebUserIsSuperToken ( inRequest = inRequest , inGSettings = inGSettings ) :
lActivityTypeListStr = " "
try :
lActivityTypeListStr = lInput [ ' Def ' ]
except Exception as e :
lActivityTypeListStr = " Has some error with Activity Type read "
if lL : lL . info ( f " ServerSettings.pyOpenRPA_Processor. User activity from web. Domain: { inRequest . OpenRPA [ ' Domain ' ] } , Username: { inRequest . OpenRPA [ ' User ' ] } , ActivityType: { lActivityTypeListStr } " )
# Append in list
inGSettings [ " ProcessorDict " ] [ " ActivityList " ] . append ( lInput )
# Execute activity list
def pyOpenRPA_ActivityListExecute ( inRequest , inGSettings ) :
# Recieve the data
lL = inGSettings [ " Logger " ]
lValueStr = None
if inRequest . headers . get ( ' Content-Length ' ) is not None :
lInputByteArrayLength = int ( inRequest . headers . get ( ' Content-Length ' ) )
@ -280,9 +302,28 @@ def pyOpenRPA_ActivityListExecute(inRequest, inGSettings):
lInput = json . loads ( lInputByteArray . decode ( ' utf8 ' ) )
# If list - operator plus
if type ( lInput ) is list :
# Logging info about processor activity if not SuperToken ()
if not __Orchestrator__ . WebUserIsSuperToken ( inRequest = inRequest , inGSettings = inGSettings ) :
lActivityTypeListStr = " "
try :
for lActivityItem in lInput :
lActivityTypeListStr + = f " { lActivityItem [ ' Def ' ] } ; "
except Exception as e :
lActivityTypeListStr = " Has some error with Activity Type read "
if lL : lL . info ( f " ServerSettings.pyOpenRPA_ActivityListExecute. User activity from web. Domain: { inRequest . OpenRPA [ ' Domain ' ] } , Username: { inRequest . OpenRPA [ ' User ' ] } , ActivityType: { lActivityTypeListStr } " )
# Execution
lResultList = Processor . ActivityListExecute ( inGSettings = inGSettings , inActivityList = lInput )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList ) , " utf8 " )
else :
# Logging info about processor activity if not SuperToken ()
if not __Orchestrator__ . WebUserIsSuperToken ( inRequest = inRequest , inGSettings = inGSettings ) :
lActivityTypeListStr = " "
try :
lActivityTypeListStr = lInput [ ' Def ' ]
except Exception as e :
lActivityTypeListStr = " Has some error with Activity Type read "
if lL : lL . info ( f " ServerSettings.pyOpenRPA_ActivityListExecute. User activity from web. Domain: { inRequest . OpenRPA [ ' Domain ' ] } , Username: { inRequest . OpenRPA [ ' User ' ] } , ActivityType: { lActivityTypeListStr } " )
# Execution
lResultList = Processor . ActivityListExecute ( inGSettings = inGSettings , inActivityList = [ lInput ] )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList [ 0 ] ) , " utf8 " )