3.3.1 Registering auto-start programs
The following features characterize auto-start programs:
-
You can register different programs to start in the event of normal termination and abnormal termination of transmission.
-
The time at which a specified program starts depends on how the transmission file is specified:
- file-name is specified
-
The program starts when the specified file is transmitted.
- directory-name is specified
-
The program starts when a file is transmitted to the specified directory.
-
An auto-start program is executed when transmission is completed for the registered user. To register an auto-start program for all users, specify .default in User name.
-
You can either specify from scratch an auto-start program to start, or you can edit existing registration information to specify a different auto-start program.
To register auto-start programs:
-
In the Auto-Start Program Registration window, from the Register menu, choose For File Trigger or For Directory Trigger. Alternatively, select existing registration information, and then from the Register menu, choose For File Trigger or For Directory Trigger.
The Register Auto-Start Program dialog box appears.
Figure 3‒6: Register Auto-Start Program dialog box (for files) -
Specify the items and then click Register.
You can make entries for multiple auto-start programs one after another until you click Close.
-
After registering the programs, click Close.
The following table lists and describes each item in the Register Auto-Start Program dialog box.
Item |
Setting |
---|---|
User name ((user displayed in the list)) |
Specifies a user name for registering an auto-start program. This item is mandatory. The following users displayed in the drop-down list can register auto-start programs.
|
File name/Directory name ((1 to 259-byte character string)) |
Specifies the name of the file or directory that is to be subject to automatic start. This item is mandatory. If you specify a file, specify its full path or only the file name. If you specify a directory, specify its full path. For the directory delimiter, use \. |
Program to start when transmission ends normally Program to start when transmission ends abnormally ((2 to 259-byte character string)) |
Specifies the program to start when transmission terminates normally and/or when transmission terminates abnormally. For the name of a program to start, specify its full path. When the program starts, transmission information can be passed as arguments. For details, see (1) Parameter keywords. Note that if the length of the expanded parameter keywords exceeds 2,047 bytes, start processing of the specified auto-start program will fail.
|
- About the programs to start
-
Because the specified programs are started from the JP1/File Transmission Server/FTP Server service, we recommend that you note the following:
-
Make sure that the account (user) used to start the JP1/File Transmission Server/FTP Server service is authorized to execute the specified programs.
-
Because automatic start of programs is executed in a service session that is independent of the user's logon session, some of the information might not be readable (such as the registry settings specified during the user's logon session).
-
An auto-start program cannot have a graphical user interface. If you specify that a program with a graphical user interface is to start automatically, JP1/FTP processing might be affected adversely and the service might stop during operation.
-
- Priority of program start
-
If multiple auto-start programs have been registered, the start condition (file name or directory name) might be applicable to more than one of the programs. In such a case, JP1/FTP searches the programs based on the priority order described below and starts only the first program that satisfies a priority condition. The following figure shows the priorities.
Figure 3‒7: Priority of starting auto-start programs - How to start programs when multiple files are transmitted
-
If a wildcard is used to transmit multiple files, an auto-start program is started as many times as there are file transmissions. Information is inherited to the auto-start program separately for each transmission. The transmission information cannot be inherited to all instances of the auto-start program at once.
- Organization of this subsection
(1) Parameter keywords
You can pass all the transmission-end information items to the user program by specifying a keyword in the auto-start program. You can also use keywords to pass specific transmission-end information items. The following table lists and describes the keywords.
Parameter keyword |
Information that is output |
Client |
Server |
---|---|---|---|
ALL |
All the following items |
Y |
Y |
TRNO |
Transmission number |
Y |
Y |
TCNO |
Connection number |
Y |
Y |
CARD |
Card name |
Y |
-- |
HOST |
Connection-target host name or IP address |
Y |
-- |
Connecting client's IP address |
-- |
Y |
|
PORT |
Connection-target host's port number |
Y |
-- |
USER |
Login user name |
Y |
Y |
TRTP |
|
Y |
Y |
TRCM |
|
Y |
Y |
COMP |
|
Y |
Y |
LCFN |
Local file name |
Y |
Y |
RMFN |
Remote file name |
Y |
-- |
STTM |
Transmission start time (return value of time()) |
Y |
Y |
SPTM |
Transmission end time (return value of time()) |
Y |
Y |
TRSZ |
Transmission data size (bytes) |
Y |
Y |
CMNT |
Comment |
Y |
-- |
TRST |
|
Y |
Y |
ERKD |
|
Y |
Y |
SYCN |
System call name |
Y |
Y |
SYKD |
|
Y |
Y |
ERNO |
Error number |
Y |
Y |
PLMG |
Protocol message |
Y |
-- |
SSLE |
SSL communication error number |
Y |
Y |
- About keyword specification
-
-
If any keyword other than the ones shown in the table above or an invalid keyword is specified, the specified keyword is passed to the user program.
-
If arguments to be passed to an auto-start program contain any spaces, you must enclose the keywords in double-quotation marks.
Example: "ALL"
When keywords are enclosed in double-quotation marks, the arguments are passed differently between .exe and .bat files, as shown below:
Example: A.exe "PLMG" aargv[1]=aaa bbb Example: A.bat "PLMG" a%1="aaa bbb"
-
- Example of argument specification
-
The following shows an example of specifying arguments.
- All transmission-end information:
C:\USERS\accounting\PROC ALL
- Selected transmission-end information:
C:\USERS\accounting\PROC1 TRNO USER TRCM STTM SPTM C:\USERS\accounting\PROC2 "PLMG"
- Command line during execution
-
Example 1: Specifying keywords (without double-quotation marks):
- Specification:
C:\USERS\accounting\PROC1 TRNO USER TRCM STTM SPTM
- Execution command line:
C:\USERS\accounting\PROC1 12 accounting 1 12:45:35 12:45:45 (Transmission connection number: 12, login user name: accounting, transmission command: send(1), transmission start time: 12:45:35, transmission end time: 12:45:45)
Example 2: Specifying keywords (with double-quotation marks):
- Specification:
C:\USERS\WAKA\PROC2 "PLMG"
- Execution command line:
C:\USERS\WAKA\PROC2 "550 D:\temp\test.dat:The system cannot find the path specified." (Protocol message: 550 D:\temp\test.dat:The system cannot find the path specified.)
The user can obtain the entire command line character string by using the GetCommandLine function within the termination procedure. If the user program is a C runtime process, you can use the mechanism of argc and argv.