# OpenRPA - hot fixes after the first run

dev-linux
Ivan Maslov 4 years ago
parent fb64808f7a
commit afe13e9417

@ -1,11 +1,13 @@
import os # Get abs path of the file
# Create CMD str to run file if process.exe is not running
def ProcessStartIfNotRunning(inProcessName, inFilePath):
lFileAbsPath = os.abspath(inFilePath)
def ProcessStartIfNotRunning(inProcessName, inFilePath, inFlagGetAbsPath=True):
lFileAbsPath = inFilePath
if inFlagGetAbsPath:
lFileAbsPath = os.path.abspath(inFilePath)
lResult = f'tasklist /nh /fi "imagename eq {inProcessName}" | find /i "{inProcessName}" > nul || (start {lFileAbsPath})'
return lResult
# Create CMD str to stop process
def ProcessStop(inProcessName, inFlagForceClose)
def ProcessStop(inProcessName, inFlagForceClose):
lResult = f'taskkill /im "{inProcessName}" /fi "username eq %USERNAME%"'
if inFlagForceClose:
lResult+= " /F"

@ -133,6 +133,7 @@ def SessionScreenFull(inSessionHex):
#Prepare little window
lRDPWindow = UIDesktop.UIOSelector_Get_UIO([{"title_re": f"{inSessionHex}.*", "backend": "win32"}])
lRDPWindow.set_focus()
lRDPWindow.maximize()
if not SessionIsFullScreen(inSessionHex):
lRDPWindow.type_keys("^%{BREAK}")
time.sleep(0.5)

@ -1,13 +1,14 @@
from . import CMDStr # Create CMD Strings
from . import Connector # RDP API
def ProcessStartIfNotRunning(inGlobalDict, inSessionIndex, inProcessName, inFilePath):
lCMDStr = CMDStr.ProcessStartIfNotRunning(inProcessName,inFilePath)
# 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)
def ProcessStop(inGlobalDict, inSessionIndex, inProcessName, inFlagForceClose):
lCMDStr = f'taskkill /im "{inProcessName}" /fi "username eq %USERNAME%"'
if inFlagForceClose:
lCMDStr+= " /F"

Loading…
Cancel
Save