Creating a Script File for the Command Line BIC - EnterWorks_Process_Exchange_(EPX) - 10.5

EnterWorks Process Exchange (EPX)

Product type
Software
Portfolio
Verify
Product family
EnterWorks
Product
Precisely EnterWorks > EnterWorks
Precisely EnterWorks
Precisely EnterWorks > EnterWorks Process Exchange (EPX)
Version
10.5
Language
English
Product name
Precisely EnterWorks
Title
EnterWorks Process Exchange (EPX)
Copyright
2023
First publish date
2007
Last updated
2024-01-18
Published on
2024-01-18T18:45:39.198479

Before you can use the Command Line BIC in a process flow, you must create a script file for the BIC to execute. Using a text editor, open a new file. You can enter any valid commands that are supported by the operating system in which EPX is running.

The Windows example below uses a script file and two batch files. As a customer's name is passed through the Command Line BIC activity, their name is placed in a file with a unique filename (the customer's name). A directory bearing the customer's name is then created and the file containing the customer's name is moved to the new directory. For the following example, the customer's name is Mike Johnson.

The sample script file contains the commands:

echo SET CUSTOMER=%LastName%_%FirstName%>c:\docs\customer.bat
echo %FirstName% %LastName% > c:\docs\customer.txt
copy c:\docs\customer.txt "d:\data\customers\%LastName%_%FirstName%.txt"
c:\docs\changedir.bat
  • The script file first creates a batch file in c:\docs named customer.bat, which will be called in a moment. The batch file will be used to create a system variable called CUSTOMER, which will represent the customer's name in the format LastName_FirstName. (Executing a SET command directly from the script does not create a system variable.) For customer Mike Johnson, the batch file contains the command SET CUSTOMER=Johnson_Mike.
  • The batch file then writes the name "Mike Johnson" to the file c:\docs\customer.txt. This file is for temporary use and is overwritten every time the Command Line BIC activity passes a new customer name.
  • The script copies the contents of customer.txt as a new file, d:\data\customers\ Johnson_Mike.txt. (Here, d:\data\customers is a pre-existing directory.)
  • The script file then executes the batch file c:\docs\changedir.bat.

The task performed in this example now requires a directory change. However, changing directories is not allowed in scripts executed by the Command Line BIC, so the command to change directories is executed via a batch file (as are the remainder of the commands in this task).

The sample batch file, changedir.bat, contains the commands:

CALL c:\docs\customer.bat
d:
cd data\customers
md "%CUSTOMER%"
move "%CUSTOMER%.txt" ".\%CUSTOMER%\%CUSTOMER%.txt"
  • The changedir.bat file first calls the customer.bat file that was created in the script. The customer.bat file executes, creating a system variable called CUSTOMER with a value of "Johnson_Mike".
  • The changedir.bat changes the current drive to d:, and then changes the current directory to d:\data\customers.
  • The batch file now creates a new directory under d:\data\customers, called \Johnson_Mike.
  • Then, the batch file moves the file Johnson_Mike.txt from d:\data\customers (the destination to where it was copied by the script) to d:\data\customers\Johnson_Mike.