About the Task Manager - Conductor - Foundation 23.2 - Foundation 23.2 - Ready - Hyland RPA - external

Hyland RPA Conductor

Platform
Hyland RPA
Product
Conductor
Release
Foundation 23.2
License

The Task Manager controls and executes the bots post and pre-launch scripts. The displayed pre-launch and post-launch scripts transfer files between a network share and the local client executing the workflow files (for example, the client pulls the latest workflow version from the share before execution). Pre-launch scripts are also used for process initialization tasks, which may include screen resolution updates or closing open applications. The post-launch script might be used to move/copy local data or files to the network drive when the process is completed.

Name Description
(1) Menu Bar Menu bar to create, edit or delete the Task Manager.
(2) List of Task Managers List of all available Task Managers.

Name Description
Name Name of your Task Manager.
Description Give a short description of your Task Manager.
PreLaunchCodeScript Enter code snippet for PreLaunchScript.
PostLaunchCodeScript Enter code snippet for PostLaunchScript
Note: The Hyland RPA Conductor fetches the Task Manager dynamically before each task, so also your changes in between will be considered.

The following code snippets can be used as a template for individual pre & post-launch scripts and are set as default scripts in your Hyland RPA Manager. Just edit the variables to the parameters of your choice.

Pre-Launch

string source = @"\\DATA.FILESHARE";
string processPath = source + @"\Repository\Processes\RPA\Demo\Deployment";
string librariesPath = source + @"\Libraries\Deployment";
string destination = @"C:\HylandRPA";
string logsEnabled = "ON";
string logsPath = source + @"\Scripts\Logs\%COMPUTERNAME%";
int timeoutSeconds = 600;
System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; var argsList = new string[] {"PreLaunch", timeoutSeconds.ToString(), logsEnabled, logsPath, destination, source, processPath, librariesPath, ""}; process.StartInfo.FileName = source + @"\Scripts\Taskmanager_Bootloader.bat"; process.StartInfo.Arguments = "\"" + String.Join("\" \"", argsList) + "\""; process.Start(); process.WaitForExit();

string source = Please place your file share path indicating the HylandRPA root directory here. Please ensure the availability of required files for example, \\DATA.FILESHARE\Scripts.\Taskmanager_Bootloader.bat and \\DATA.FILESHARE\Scripts\Taskmanager_PreLaunch.bat respectively.

string processPath = Please place your process folder path here, not the file path!

string librariesPath = Please place your library folder path here.

string destination = Please place your local process folder here. All data will be copied locally (for each Client) into this directory.

string logsEnabled = Detailed execution logs of the scripts. Choose "ON"; or "OFF"; Alternatively ("1"; or "0"; and "True"; or "False";

string logsPath = Please place your log folder path here.

Post-Launch

string destination = @"\\DATA.FILESHARE";
string fileshareProtocols = destination + @"\Protocols";
string logsEnabled = "ON";
string logsPath = destination + @"\Scripts\Logs\%COMPUTERNAME%";
int timeoutSeconds = 600;
System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; var argsList = new string[] {"PostLaunch", timeoutSeconds.ToString(), logsEnabled, logsPath, "", destination, "", "", fileshareProtocols}; process.StartInfo.FileName = destination + @"\Scripts\Taskmanager_Bootloader.bat"; process.StartInfo.Arguments = "\"" + String.Join("\" \"", argsList) + "\""; process.Start(); process.WaitForExit();

string destination = Please place your file share path indicating the HylandRPA root directory here. Please ensure the availability of the required file: \\DATA.FILESHARE\Scripts\Taskmanager_PostLaunch.bat.

string fileshareProtocols = Please place your file share protocol folder path here.

string logsEnabled = Detailed execution logs of the scripts. Choose "ON"; or "OFF"; Alternatively ("1"; or "0"; and "True"; or "False";

string logsPath = Please place your log folder path here.

The scripts above refer to 3 different batch-files.

  • Bootloader
  • Pre-Launch
  • Post-Launch

Make sure to enter the correct file path to these batch files in your Taskmanager scripts. The default path is the following: source + @"\Scripts. There is no need to edit the batch-files, the whole configuration is done in the Hyland RPA Manager.

Bootloader Batch File

source + @"\Scripts\Taskmanager_Bootloader.bat

@echo off & setlocal
setlocal enableDelayedExpansion
TITLE HYLAND RPA BOOTLOADER

set TYPE=%~1
set TIMEOUT=%~2
set LOGS_ENABLED=%~3
set LOGS_PATH=%~4
set LOCAL_PATH=%~5
set FILESHARE_PATH=%~6
set PROCESS_PATH=%~7
set LIBRARIES_PATH=%~8
set PROTOCOLS_PATH=%~9

rem check if value is "1" or "ON" or "on" or "true" or "True" or "TRUE"
set TESTVAR=%LOGS_ENABLED%
for %%A in ("1" "ON" "on" "true" "True" "TRUE") do if "%TESTVAR%" equ %%A (set TESTVAR=1)
if "%TESTVAR%" equ "1" (set LOGS_ENABLED=1) else (set LOGS_ENABLED=0)

set LOGFILE=%TEMP%\Taskmanager_%TYPE%.txt
set hlpr=
set exec=""%FILESHARE_PATH%\Scripts\Taskmanager_%TYPE%.bat" "%LOGS_ENABLED%" "%LOGS_PATH%" "%LOCAL_PATH%" "%FILESHARE_PATH%" "%PROCESS_PATH%" "%LIBRARIES_PATH%" "%PROTOCOLS_PATH%""


if "%TYPE%" equ "" (set hlpr="1st argument must be either PreLanch or PostLaunch")
if "%TIMEOUT%" equ "" (set hlpr="2nd argument must be non empty value") else if %TIMEOUT% leq 0 (set hlpr="2nd argument must be a number greater than 0")
if "%LOGS_ENABLED%" equ "1" (
 if "%LOGS_PATH%" equ "" (set hlpr="6th argument must be non empty value") else (mkdir "%LOGS_PATH%" & set LOGFILE=%LOGS_PATH%\Taskmanager_%TYPE%.txt)
)
if not exist "%FILESHARE_PATH%\Scripts\Taskmanager_%TYPE%.bat" (set hlpr="The file %FILESHARE_PATH%\Scripts\Taskmanager_%TYPE%.bat does not exist")

(
 echo ******* BOOTLOADER START **** %DATE% *** %TIME% *** %COMPUTERNAME% *** %USERNAME% ***
 echo ******* BOOTLOADER *** Append log to file "!LOGFILE!"
 echo ******* BOOTLOADER *** START %TYPE% with cmd ^(start "%TYPE%_SCRIPT" ^/MIN cmd ^/C %exec%^)
 
 if defined hlpr (
 echo ******* %TYPE% ABORTED **** Invalid parameters: !hlpr! 
 exit /B 1
 ) 
 
) >> "!LOGFILE!"

start "%TYPE%_SCRIPT" /MIN cmd /C %exec%
 echo ******* BOOTLOADER *** %TYPE% Script has started with max. runtime of %TIMEOUT% seconds. >> "!LOGFILE!"

rem ### Check Loop
for /l %%i in (1,1,%TIMEOUT%) do (
 call :CHECK
)

rem ### Window not closed -> Kill %TYPE%
taskkill /FI "WINDOWTITLE eq %TYPE%_SCRIPT" /T /F
taskkill /FI "WINDOWTITLE eq Administrator: %TYPE%_SCRIPT" /T /F
echo ******* BOOTLOADER *** ABORTED %TYPE% after TIMEOUT^=%TIMEOUT% seconds **** %DATE% *** %TIME% *** %COMPUTERNAME% *** %USERNAME% *** >> "!LOGFILE!"
echo ******* BOOTLOADER *** Please check log file and increase timeout value if necessary. >> "!LOGFILE!"

exit

rem ### Checks
:CHECK
 rem CHECK 1a: %TYPE%_SCRIPT
 set "befehl=tasklist /FI "WINDOWTITLE eq %TYPE%_SCRIPT" 2>NUL | find /I "cmd.exe""

for /F "delims=*" %%p in ('!befehl! ^| findstr "cmd.exe" ') do (
 echo %TYPE% is still running
 Timeout 1
 GOTO :eof
 )

rem CHECK 1b: %TYPE%_SCRIPT (ADMIN only)
 set "befehl=tasklist /FI "WINDOWTITLE eq Administrator: %TYPE%_SCRIPT" 2>NUL | find /I "cmd.exe""

for /F "delims=*" %%p in ('!befehl! ^| findstr "cmd.exe" ') do (
 echo %TYPE% Admin is still running
 Timeout 1
 GOTO :eof
 )

rem CHECK 2: Windows PowerShell
 set "befehl=tasklist /FI "WINDOWTITLE eq Windows PowerShell" 2>NUL | find /I "cmd.exe""

for /F "delims=*" %%p in ('!befehl! ^| findstr "cmd.exe" ') do (
 echo %TYPE% is still running
 Timeout 1
 GOTO :eof
 )

echo ******* BOOTLOADER END **** %DATE% **** %TIME% **** %TYPE% Script has finished for "%PROCESS_PATH%". >> "!LOGFILE!"
if "%LOGS_ENABLED%" neq "1" (del /q /s !LOGFILE!)
exit

Pre-Launch Batch File

source + @"\Scripts\Taskmanager_PreLaunch.bat

@echo on & setlocal
setlocal enableDelayedExpansion

set LOGFILE=%~n0.txt
set LOGS_ENABLED=%~1
set LOGS_PATH=%~2
set LOCAL_PATH=%~3
set FILESHARE_PATH=%~4
set PROCESS_PATH=%~5
set LIBRARIES_PATH=%~6
set PROTOCOLS_PATH=

set hlpr=
set now=%TIME%

rem set destination path for local processes. Example: if PROCESS_PATH=Z:\Monday\Repository\Processes\RPA\YOURPROCESS\Deployment then LOCAL_REPO_PROCESSES=C:\Monday\Repository\Processes\RPA\YOURPROCESS
call set LOCAL_REPO_PROCESS=%%PROCESS_PATH:!FILESHARE_PATH!=!LOCAL_PATH!%%
set LOCAL_REPO_PROCESS=%LOCAL_REPO_PROCESS:\Deployment=%
set LOCAL_REPO_PROCESS=%LOCAL_REPO_PROCESS:\PreDeployment=%

rem set LOCAL_REPO_LIBRARIES=%LOCAL_PATH%\Libraries
call set LOCAL_REPO_LIBRARIES=%%LIBRARIES_PATH:!FILESHARE_PATH!=!LOCAL_PATH!%%
set LOCAL_REPO_LIBRARIES=%LOCAL_REPO_LIBRARIES:\Deployment=%
set LOCAL_REPO_LIBRARIES=%LOCAL_REPO_LIBRARIES:\PreDeployment=%


if "%FILESHARE_PATH%" equ "" (set hlpr="FILESHARE_PATH must be non empty value")
if "%LOCAL_PATH%" equ "" (set hlpr="LOCAL_PATH must be non empty value")
if "%LOGS_ENABLED%" equ "1" (
if "%LOGS_PATH%" equ "" (set hlpr="LOGS_ENABLED must be non empty value" & set LOGFILE=%TEMP%\!LOGFILE!) else (mkdir "%LOGS_PATH%" & set LOGFILE=%LOGS_PATH%\!LOGFILE!)
) else (set LOGFILE=%TEMP%\!LOGFILE!) 
if "%PROCESS_PATH%" equ "" (set hlpr="PROCESS_PATH must be non empty value")

(
echo. 
echo ******* PRELAUNCH START **** %DATE% **** %NOW% ********
echo.
echo Starting Prelaunch script with parameters:
echo LOCAL_PATH="%LOCAL_PATH%"
echo FILESHARE_PATH="%FILESHARE_PATH%"
echo LOGS_ENABLED="%LOGS_ENABLED%"
echo LOGS_PATH="%LOGS_PATH%"
echo PROCESS_PATH="%PROCESS_PATH%"
echo LIBRARIES_PATH="%LIBRARIES_PATH%"
echo.

if defined hlpr (
echo ******* PRELAUNCH ABORTED **** Invalid parameters: !hlpr!
exit /B 1
)

echo ****************************************************************************
echo. 
echo Copy all Custom Activities ^(Libraries^) files from "%LIBRARIES_PATH%" to "%LOCAL_REPO_LIBRARIES%"
echo. 

xcopy "%LIBRARIES_PATH%\*.*" "%LOCAL_REPO_LIBRARIES%\*.*" /I /D /Y /S /C

echo.
echo ****************************************************************************
echo. 
echo Copy all files from "%PROCESS_PATH%" to "%LOCAL_REPO_PROCESS%"
echo. 
echo ****************************************************************************

xcopy "%PROCESS_PATH%\*.*" "%LOCAL_REPO_PROCESS%\*.*" /I /Y /S /C

echo.
echo ****************************************************************************
echo. 
echo Copy all Hyland RPA Designer Activities files from "%FILESHARE_PATH%\Activities" to "%LOCAL_PATH%\Activities"
echo. 
echo ****************************************************************************
echo.

xcopy "%FILESHARE_PATH%\Activities\*.*" "%LOCAL_PATH%\Activities\*.*" /I /D /Y /S /C

) >> "!LOGFILE!" 1>> "!LOGFILE!" 2>&1

(
echo ******* PRELAUNCH END **** %DATE% **** %NOW%-%TIME% ********
echo.
) >> "!LOGFILE!"

Post-Launch Batch File

source + @"\Scripts\Taskmanager_PostLaunch.bat

@echo on & setlocal
setlocal enableDelayedExpansion

set LOGFILE=%~n0.txt
set LOGS_ENABLED=%~1
set LOGS_PATH=%~2
set LOCAL_PATH=
set FILESHARE_PATH=
set PROCESS_PATH=
set LIBRARIES_PATH=
set PROTOCOLS_PATH=%~7

set hlpr=
set now=%TIME%

if "%PROTOCOLS_PATH%" equ "" (set hlpr="PROTOCOLS_PATH must be non empty value")
if "%LOGS_ENABLED%" equ "1" (
 if "%LOGS_PATH%" equ "" (set hlpr="LOGS_ENABLED must be non empty value" & set LOGFILE=%TEMP%\!LOGFILE!) else (mkdir "%LOGS_PATH%" & set LOGFILE=%LOGS_PATH%\!LOGFILE!)
) else (set LOGFILE=%TEMP%\!LOGFILE!)

(

echo. 
 echo ******* POSTLAUNCH START **** %DATE%**** %NOW% ********

echo Starting Postlaunch script with parameters: 
 echo FILESHARE_PATH="%FILESHARE_PATH%" 
 echo PROTOCOLS_PATH="%PROTOCOLS_PATH%" 
 echo LOGS_ENABLED="%LOGS_ENABLED%" 
 echo LOGS_PATH="%LOGS_PATH%"
 echo.

if defined hlpr (
 echo ******* POSTLAUNCH ABORTED **** Invalid parameters: !hlpr!
 exit /B 1
 )

if EXIST "%UserProfile%\Desktop\Protocols\*.*" (
 echo. 
 echo **************************************************************************** 
 echo. 
 echo Move all Protocols from "%UserProfile%\Desktop\Protocols" to "%PROTOCOLS_PATH%" 
 echo. 
 echo **************************************************************************** 
 
 xcopy "%UserProfile%\Desktop\Protocols\*.*" "%PROTOCOLS_PATH%\*.*" /I /S /Y /D 
 
 if errorlevel 5 (echo ******* ERROR *******
 ) else (
 if errorlevel 4 (echo ******* ERROR *******
 ) else (
 if errorlevel 0 (rmdir /q /s "%UserProfile%\Desktop\Protocols"
 )
 )
 ) 
 ) else (
 echo ******* POSTLAUNCH INFO **** No protocols found in "%UserProfile%\Desktop\Protocols ************* 
 )
 
 if EXIST "%UserProfile%\Desktop\Protokoll\*.*" (
 echo. 
 echo **************************************************************************** 
 echo. 
 echo Move all Protocols from "%UserProfile%\Desktop\Protokoll" to "%PROTOCOLS_PATH%" 
 echo. 
 echo **************************************************************************** 
 
 xcopy "%UserProfile%\Desktop\Protokoll\*.*" "%PROTOCOLS_PATH%\*.*" /I /S /Y /D 
 
 if errorlevel 5 (echo ******* ERROR *******
 ) else (
 if errorlevel 4 (echo ******* ERROR *******
 ) else (
 if errorlevel 0 (rmdir /q /s "%UserProfile%\Desktop\Protokoll"
 )
 )
 )
 ) else (
 echo ******* POSTLAUNCH INFO **** No protocols found in "%UserProfile%\Desktop\Protokoll ************* 
 )
 
 rem Copy CONDUCTOR-Log from Client to network drive. 
 rem xcopy "%TEMP%\Am.Net.Core.Conductor.log" "%FILESHARE_PATH%\Scripts\Logs\$%COMPUTERNAME%\*.*" /Y /D


) >> "!LOGFILE!" 1>> "!LOGFILE!" 2>&1
 
(
 echo. 
 echo ******* POSTLAUNCH END ****%DATE% **** %NOW%-%TIME% ******** 
 echo.
) >> "!LOGFILE!"