You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# ATTENTION! HERE IS NO Relative import because it will be imported dynamically
|
|
|
|
from pyOpenRPA.Tools.RobotRDPActive import CMDStr # Create CMD Strings
|
|
|
|
from pyOpenRPA.Tools.RobotRDPActive import Connector # RDP API
|
|
|
|
def ProcessStartIfNotRunning(inGlobalDict, inSessionIndex, inProcessName, inFilePath, inFlagGetAbsPath=True):
|
|
|
|
lCMDStr = CMDStr.ProcessStartIfNotRunning(inProcessName,inFilePath, inFlagGetAbsPath= inFlagGetAbsPath)
|
|
|
|
# Calculate the session Hex
|
|
|
|
lSessionHex = inGlobalDict["RDPList"][inSessionIndex]["SessionHex"]
|
|
|
|
# Run CMD
|
|
|
|
Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=lCMDStr, inModeStr="RUN")
|
|
|
|
# Create CMD str to stop process
|
|
|
|
def ProcessStop(inGlobalDict, inSessionIndex, inProcessName, inFlagForceClose):
|
|
|
|
lCMDStr = f'taskkill /im "{inProcessName}" /fi "username eq %USERNAME%"'
|
|
|
|
if inFlagForceClose:
|
|
|
|
lCMDStr+= " /F"
|
|
|
|
# Calculate the session Hex
|
|
|
|
lSessionHex = inGlobalDict["RDPList"][inSessionIndex]["SessionHex"]
|
|
|
|
# Run CMD
|
|
|
|
Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=lCMDStr, inModeStr="RUN")
|