@ -1,6 +1,7 @@
import json , os
import json , os
import copy
import copy
from inspect import signature # For detect count of def args
from inspect import signature # For detect count of def args
from . import __Orchestrator__
#ControlPanelDict
#ControlPanelDict
from desktopmagic . screengrab_win32 import (
from desktopmagic . screengrab_win32 import (
getDisplayRects , saveScreenToBmp , saveRectToBmp , getScreenAsImage ,
getDisplayRects , saveScreenToBmp , saveRectToBmp , getScreenAsImage ,
@ -257,6 +258,7 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict):
# Add activity item or activity list to the processor queue
# Add activity item or activity list to the processor queue
# Body is Activity item or Activity List
# Body is Activity item or Activity List
def pyOpenRPA_Processor ( inRequest , inGSettings ) :
def pyOpenRPA_Processor ( inRequest , inGSettings ) :
lL = inGSettings [ " Logger " ]
# Recieve the data
# Recieve the data
lValueStr = None
lValueStr = None
if inRequest . headers . get ( ' Content-Length ' ) is not 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 ' ) )
lInput = json . loads ( lInputByteArray . decode ( ' utf8 ' ) )
# If list - operator plus
# If list - operator plus
if type ( lInput ) is list :
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
inGSettings [ " ProcessorDict " ] [ " ActivityList " ] + = lInput
else :
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 )
inGSettings [ " ProcessorDict " ] [ " ActivityList " ] . append ( lInput )
# Execute activity list
# Execute activity list
def pyOpenRPA_ActivityListExecute ( inRequest , inGSettings ) :
def pyOpenRPA_ActivityListExecute ( inRequest , inGSettings ) :
# Recieve the data
# Recieve the data
lL = inGSettings [ " Logger " ]
lValueStr = None
lValueStr = None
if inRequest . headers . get ( ' Content-Length ' ) is not None :
if inRequest . headers . get ( ' Content-Length ' ) is not None :
lInputByteArrayLength = int ( inRequest . headers . get ( ' Content-Length ' ) )
lInputByteArrayLength = int ( inRequest . headers . get ( ' Content-Length ' ) )
@ -280,9 +302,28 @@ def pyOpenRPA_ActivityListExecute(inRequest, inGSettings):
lInput = json . loads ( lInputByteArray . decode ( ' utf8 ' ) )
lInput = json . loads ( lInputByteArray . decode ( ' utf8 ' ) )
# If list - operator plus
# If list - operator plus
if type ( lInput ) is list :
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 )
lResultList = Processor . ActivityListExecute ( inGSettings = inGSettings , inActivityList = lInput )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList ) , " utf8 " )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList ) , " utf8 " )
else :
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 ] )
lResultList = Processor . ActivityListExecute ( inGSettings = inGSettings , inActivityList = [ lInput ] )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList [ 0 ] ) , " utf8 " )
inRequest . OpenRPAResponseDict [ " Body " ] = bytes ( json . dumps ( lResultList [ 0 ] ) , " utf8 " )