Job Management Partner 1/Software Distribution Administrator's Guide Volume 1

[Contents][Glossary][Index][Back][Next]

Appendix D.4 Script functions

The following explains the functions that can be used in the JP1/Software Distribution installation and collection scripts. Using these functions, you can acquire the program version information or add new icons to Program Manager.

The following table lists the script functions.

Table D-2 Script functions

Script function Use category Explanation
Backup I Creates a backup of the software of the current version.
Collection C Remotely collects a directory or file.
CreateIcon I Adds a specified program icon to a specified program group.
CreateProgramGroup I Creates a program group with a specified name in Program Manager.
CreateShortCut I Creates a shortcut at the remote installation destination.
DelBackup I Deletes a backup at the remote installation destination.
DmSetStatus I, C Sets an error status code.
GetBackupStatus I Returns a signal to indicate whether a backup is acquired.
GetErrorStatus I, C Locates an error in a script process.
GetResourceName I Determines the package ID of the software to be installed.
GetResourceVersion I Determines the version and generation numbers of the software to be installed.
GetSoftwareName I Acquires the package name of the software to be installed.
GetStatus I, C Acquires the current value of the status set by SetStatus().
Install I Restores files to a specified directory.
LogFile I, C Outputs an arbitrary message to a log file.
MsgBox I Displays a message within a dialog box.
Restore I Restores the software whose backup was acquired.
SetStatus I, C Sets an arbitrary processing state as the status.
Setup I Starts a setup program using files restored by the Install function.
Shell I, C Starts an external program.
SysInfoCoProcessor I Checks whether a coprocessor is present.
SysInfoCpuType I Checks the CPU type.
SysInfoHDEmpty I Checks the free space of the hard disk.
SysInfoMemory I Acquires information about memory capacities.
SysInfoOSVersion I Determines the version of the operating system being used.
VerInfo I Determines the version of specified software.
VerInfoEx I Determines the version of the installed software from a package name or package ID.

Legend:

I: Usable in installation scripts.

C: Usable in collection scripts.


The script functions must be written as described below. Use zero or one or more spaces, tabs, or line feed characters.

function-name (function-argument1 [, function-argument2 ])

Note that the alphabetical characters used in a function name are case sensitive. The number of arguments for individual functions is fixed, but varies from one function to another. You can specify the arguments by entering either a direct value or a variable. However, the system variable should be specified by entering a direct value.

Organization of this subsection
(1) Backup function
(2) Collection function
(3) CreateIcon function
(4) CreateProgramGroup function
(5) CreateShortCut function
(6) DelBackup function
(7) DmSetStatus function
(8) GetBackupStatus function
(9) GetErrorStatus function
(10) GetResourceName function
(11) GetResourceVersion function
(12) GetSoftwareName function
(13) GetStatus function
(14) Install function
(15) LogFile function
(16) MsgBox function
(17) Restore function
(18) SetStatus function
(19) Setup function
(20) Shell function
(21) SysInfoCoProcessor function
(22) SysInfoCpuType function
(23) SysInfoHDEmpty function
(24) SysInfoMemory function
(25) SysInfoOSVersion function
(26) VerInfo function
(27) VerInfoEx function

(1) Backup function

(a) Description

The Backup function obtains a backup of the software that has already been installed and has a version different from the software you want to remotely install.

(b) Format
Backup()
(c) Arguments

None

(d) Return value

None

(2) Collection function

(a) Description

The Collection function remotely collects the specified directory or file.

At least three collection functions must be called with a collect file. First, call a Collection function specifying COLLECTION_START as the argument to initialize the setting for remote collection. Then, call a Collection function specifying a file or directory in the argument to set the file or directory to be remotely collected. This Collection function can be repeated up to 100 times to set more than one file or directory. Last, call a Collection function specifying COLLECTION_END as the argument to execute the collection.

(b) Format
Collection(COLLECTION_START)
Collection(String name-of-directory-or-file-to-be-remote-collected)
Collection(COLLECTION_END)
(c) Arguments
(d) Return value

None

(3) CreateIcon function

(a) Description

The CreateIcon function adds an icon to Program Manager. Specify the program group to which you want to add an icon, the executable file to be added, and the title of the icon.

This function cannot be used in the background installation mode.

(b) Format
CreateIcon(String program-group-name,
           String pathname-of-executable-file,
           String icon-title)
(c) Arguments
(d) Return value

None

(e) Notes

This function cannot be used to install other companies' software or Hitachi program products.

(4) CreateProgramGroup function

(a) Description

The CreateProgramGroup function creates a program group in Program Manager, with the name you specified.

This function cannot be used in the background installation mode.

(b) Format
CreateProgramGroup(String program-group-name)
(c) Arguments
(d) Return value

None

(e) Notes

This function cannot be used to install other companies' software or Hitachi program products.

(5) CreateShortCut function

(a) Description

The CreateShortCut function creates a shortcut at the destination of remote installation. This function can be used only when the destination of remote installation uses Windows Me, Windows 98, or Windows 95.

This function cannot be used in the background installation mode.

(b) Format
CreateShortCut(String pathname-of-shortcut-creating-folder,
String pathname-of-shortcut-original-file,
String shortcut-title)
(c) Arguments
(d) Return value

None

(6) DelBackup function

(a) Description

The DelBackup function deletes the backup obtained by the Backup function. If this function is called when the backup is not obtained, the call does not result in an error and is ignored.

(b) Format
DelBackup()
(c) Arguments

None

(d) Return value

None

(7) DmSetStatus function

(a) Description

The DmSetStatus function sets the specified character string as the error status code (the end status for the distribution management system of UNIX). Set an error status code when you want to make the script terminate if the condition is not satisfied. The error status code you set is reported to the distribution management system as the termination code of the installation or collection.

(b) Format
DmSetStatus(System error-status-code)
(c) Arguments
(d) Return value

None

(8) GetBackupStatus function

(a) Description

The GetBackupStatus function returns whether or not the backup is obtained by the remote installation.

(b) Format
System GetBackupStatus()
(c) Arguments

None

(d) Return value

(9) GetErrorStatus function

(a) Description

The GetErrorStatus function checks where an error occurred in the script. This function can be used only in On InstallError statements and On CollectionError statements.

(b) Format
System GetErrorStatus()
(c) Arguments

None

(d) Return value

(10) GetResourceName function

(a) Description

The GetResourceName function obtains the package ID of the software to be installed.

(b) Format
String GetResourceName()
(c) Arguments

None

(d) Return value

(11) GetResourceVersion function

(a) Description

The GetResourceVersion function obtains the version and the generation number of the software to be installed.

(b) Format
String GetResourceVersion()
(c) Arguments

None

(d) Return value

(12) GetSoftwareName function

(a) Description

The GetSoftwareName function obtains the package name of the software to be installed.

(b) Format
String GetSoftwareName()
(c) Arguments

None

(d) Return value

(13) GetStatus function

(a) Description

The GetStatus function obtains the current value of the status set by the SetStatus function.

(b) Format
Integer GetStatus()
(c) Arguments

None

(d) Return value
(e) Notes

When the status has not set by the SetStatus function, 0 is returned.

(14) Install function

(a) Description

The Install function installs (restores) the distributed software.

(b) Format
Install(String destination-directory-character-string)
(c) Arguments
(d) Return value

None

(e) Examples

Example 1: To specify a drive name with a number:
  :
Install("1:\users\home\instdir")
  :

Example 2: To specify a Setup function also:
  :
Install(SETUP_DIRECTORY)
  :
Setup()
  :
(f) Notes

You cannot write multiple Install functions in the same script.

(15) LogFile function

(a) Description

The LogFile function outputs a specified message to the log files. The output destinations are LOG\MAIN.LOG and LOG\USER.LOG under the directory in which the client is installed. Use MAIN.LOG to check the messages in connection with the message log for the client. Use USER.LOG to check only the messages output by the script writer. This log is also collected in the event log of Windows NT (assigned an event ID of 60000 or more).

Example of an item in LOG\MAIN.LOG:
100 2004/2/3 22:29:12:13 Informational User user-message: PROGRAM XXX UPDATED

Example of an item in LOG\USER.LOG:
150 2004/2/3 22:29:12:13 1128 PROGRAM XXX UPDATED
(b) Format
LogFile(String message)
(c) Arguments
(d) Return value

None

(e) Notes

Use the LogFile function sparingly. Excessive use of the LogFile function increases disk I/O, and performance may suffer.

(16) MsgBox function

(a) Description

The MsgBox function displays a specified message in a dialog box. The button displayed on the dialog box is OK only.

This function cannot be used in the background installation mode.

(b) Format
MsgBox(String message, Integer display-time)
(c) Arguments
(d) Return value

None

(17) Restore function

(a) Description

The Restore function restores the previous version of the software from its backup created before the software was remotely installed. If this function is called when the backup has not been created, the call does not result in an error and is ignored. When this function is coded in an On InstallError Do statement, the restoration from the backup is performed only if an error occurs during remote installation.

(b) Format
Restore()
(c) Arguments

None

(d) Return value

None

(18) SetStatus function

(a) Description

The SetStatus function allows you to store the script processing status as a status code. The status code you store can be obtained by the GetStatus function.

When the script terminates, the status code set last is reported to the distribution management system as the termination code of the installation or collection.

(b) Format
SetStatus(Integer status-code)
(c) Arguments
(d) Return value

None

(e) Notes

A status code of 0 is assumed until the first SetStatus function is executed in the script.

(19) Setup function

(a) Description

The Setup function activates a setup program using the files restored by the Install function.

Most of the setup programs for Windows applications are GUI based. To use a GUI-based setup program with JP1/Software Distribution, create either an AIT file or a recorder file (a Visual Test script). This file is necessary for the system to respond to the screens at the client automatically. The Automatic Installation Tool executable program library automatically responds to the GUI setup program, using the AIT file, or the Visual Test executable program library automatically responds using the recorder file.

For details about how to create an AIT file or recorder file, see the manual Automatic Installation Tool Description and Reference.

This function cannot be used in the background installation mode.

(b) Format
Setup()
(c) Arguments

None

(d) Return value

None

(e) Notes

(20) Shell function

(a) Description

The Shell function activates an external program.

(b) Format
Shell(String full-pathname-of-program)
(c) Arguments
(d) Return value

None

(e) Examples

Example 1
Shell("c:\winnt\system32\notepad.exe")

Example 2
Dim S As String
S = "1:\users\home\prog01.exe file01.txt"
Shell(S)

Example 3
Shell("""c:\Program Files\prog2.exe""")

Example 4
Shell("""c:\Program Files\Test\aaa.exe"" /f C:\temp\bbb.exe /I: /S ""ccc.txt""")
(f) Notes

(21) SysInfoCoProcessor function

(a) Description

The SysInfoCoProcessor function returns whether or not the coprocessor exists.

(b) Format
System SysInfoCoProcessor()
(c) Arguments

None

(d) Return value
(e) Notes

If you attempt to perform remote installation to Windows without including the presence of the coprocessor in the system conditions, the script results in an error because the system conditions are not satisfied.

(22) SysInfoCpuType function

(a) Description

The SysInfoCpuType function obtains the CPU type.

(b) Format
System SysInfoCpuType()
(c) Arguments

None

(d) Return value
(e) Notes

For an Intel-compatible CPU, such as Crusoe, I_PENTIUM is returned.

(23) SysInfoHDEmpty function

(a) Description

Obtains the amount of free space in a specified hard disk.

(b) Format
Integer SysInfoHDEmpty(System drive-name)
(c) Arguments
(d) Return value

(24) SysInfoMemory function

(a) Description

The SysInfoMemory function obtains the size of a specified type of memory. Specify the type of memory in the argument.

(b) Format
Integer SysInfoMemory (memory-type)
(c) Arguments
(d) Return value

(25) SysInfoOSVersion function

(a) Description

The SysInfoOSVersion function obtains the version of the operating system in use. Specify the type of operating system.

(b) Format
String SysInfoOSVersion(operating-system-type)
(c) Arguments
(d) Return value
(e) Notes

(26) VerInfo function

(a) Description

The VerInfo function returns the version of the software specified by package-ID. Specify ACTIVE_VERSION (currently operating new version) as the version type.

(b) Format
String VerInfo(version-type, String package-ID)
(c) Arguments
(d) Return value
(e) Notes

This function obtains the version of the software installed using JP1/Software Distribution. For the software directly installed from media such as floppy disks, the version cannot be obtained by this function.

(27) VerInfoEx function

(a) Description

The VerInfoEx function obtains the version of an already installed package from the package name or package ID.

(b) Format
String VerInfoEx(PACKAGE_NAME, String package-name)
String VerInfoEx(PACKAGE_ID, String package-ID)
(c) Arguments
(d) Return value
(e) Notes

This function obtains the version of the software installed using JP1/Software Distribution. For the software directly installed from media such as floppy disks, this function can obtain only the versions of the software that can be found by using the software search functions of JP1/Software Distribution.