Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.1 List of basic commands

Table 8-1 lists the basic commands that you can use when creating a script. The numbers enclosed in parentheses in the Command column identify the version with which the command was first introduced (if there is no version number shown, the command has been supported since version 01-00).

Table 8‒1: List of basic commands

Category

Command

Description

Variable manipulation

Dim

Declares a variable and allocates space in memory.

Dim (Array) (06-00)

Declares an array variable and allocates space in memory.

SetEnvironment or SetEnv

Sets an environment variable.

GetEnvironment or GetEnv

Gets an environment variable.

SetGV

Sets a global variable on the local or remote PC.

GetGV

Gets a global variable on the local or remote PC.

DeleteGV (06-00)

Deletes a global variable on the local or remote PC.

GetArrayCount (06-00)

Counts the elements in an array variable (or the number of rows or columns in a two-dimensional array).

String manipulation

InStr (05-00)

Searches for a specified substring in a string and returns the character position (offset from the beginning) of the first occurrence.

InArray (06-00)

Searches for a specified string among the elements in an array variable, and returns the index number of the first occurrence.

Len

Returns the length of a string.

Lcase

Converts uppercase characters in a string to lowercase.

Ucase

Converts lowercase characters in a string to uppercase.

Left

Returns a specified number of characters from the left side of a string.

Mid

Returns a specified number of characters from inside a string.

Right

Returns a specified number of characters from the right side of a string.

Space

Returns a string containing a specified number of spaces.

Ltrim (05-00)

Returns a string without leading spaces.

Rtrim (05-00)

Returns a string without trailing spaces.

Trim (05-00)

Returns a string without leading or trailing spaces.

+ (string concatenation)

Performs string concatenation on two expressions.

& (string concatenation) (06-00)

Performs string concatenation on two expressions.

&= (string concatenation) (06-51)

Performs string concatenation on a variable and an expression, and assigns the result to the variable.

AddStr (05-00)

Returns a concatenated string consisting of two or more strings with specified delimiters inserted.

SeparateStrCount (05-00)

Returns the number of strings split at a specified delimiter.

SeparateStr (05-00)

Returns a string split at a specified delimiter.

Str (05-20)

Returns a specified value as a string.

Format (05-20)

Returns a specified value as a formatted string.

IsLower (06-00)

Checks whether a string is lowercase characters, and returns True or False.

IsUpper (06-00)

Checks whether a string is uppercase characters, and returns True or False.

IsSingleChar (06-00)

Checks whether a string is one-byte characters, and returns True or False.

IsMultiChar (06-00)

Checks whether a string is two-byte characters, and returns True or False.

Working with dates

Date

Returns the current date.

Time

Returns the current time.

Year

Returns a four-digit number representing the year for a specified date.

Month

Returns a two-digit number in the range 1 to 12, representing the month for a specified date.

Day

Returns a two-digit number in the range 1 to 31, representing the day for a specified date.

Weekday

Returns a one-digit number in the range 1 (Sunday) to 7 (Saturday), representing the day of the week for a specified date.

Hour

Returns a two-digit number in the range 0 to 23, representing the hour for a specified time.

Minute

Returns a two-digit number in the range 0 to 59, representing the minute for a specified time.

Second

Returns a two-digit number in the range 0 to 59, representing the second for a specified time.

CalcDate (05-20)

Adds or subtracts a specified interval to or from a specified date.

CompDate (05-20)

Compares two specified dates and returns True or False.

GetDateCount (05-20)

Calculates the difference between two dates.

CalcTime (05-20)

Adds or subtracts a specified interval to or from a specified time.

CompTime (05-20)

Compares two specified times and returns True or False.

GetTimeCount (05-20)

Calculates the difference between two times.

IsLeapYear (05-20)

Checks whether a specified year is a leap year and returns True or False.

File and folder management

IniRead

Reads data from an initialization file.

IniWrite

Sets data in an initialization file.

TextFileReplace

Replaces a specified string in a text file.

TextOpen (05-00)

Opens a text file.

TextClose (05-00)

Closes a text file.

TextRead (05-00)

Reads one line of data from a text file.

TextWrite (05-00)

Writes data to a text file.

TextSeek (05-00)

Moves the read/write position in a text file.

GetTextPosition (05-00)

Returns the current read/write position in a text file.

MakeDir

Creates a folder.

DeleteDir

Deletes a folder.

DeleteFile

Deletes a file.

Rename

Renames a file.

TempDir

Gets a temporary folder name.

TempFile

Creates a temporary file.

SetFileAttribute or SetFileAttr

Sets file attributes.

GetFileAttribute or GetFileAttr (06-00)

Gets file attributes.

SetFileTime (05-10)

Sets the date and time of a file.

GetFileTime (05-10)

Gets the date and time of a file.

GetFileSize (06-00)

Gets the size of a file.

GetVersionInfo or GetVerInfo (06-00)

Gets version information for a file.

SplitFile (05-10)

Partitions a file by a specified size.

CatFiles (05-10)

Joins split files into one file.

SetStandardFile or SetStdFile (05-10)

Sets the standard input, standard output, and standard error files for processes called by the Exec command.

ResetStandardFile or ResetStdFile (05-10)

Resets the standard input, standard output, and standard error files for processes called by the Exec command.

SplitPath

Analyzes a full path.

MakePath

Creates a full path.

SetPath

Sets a folder path to the executable folder.

GetPath

Gets the path to the executable folder.

SetVolumeLabel or SetVolLabel (05-10)

Sets the volume label of a disk.

GetVolumeLabel or GetVolLabel (05-10)

Gets the volume label of a disk.

GetDiskFreeSpace (05-10)

Gets the amount of free space on a disk.

Copy

Copies files.

Message output

InputBox

Displays a message and entry boxes in a dialog box, and returns the entry box contents when the user enters text or clicks a button.

Message

Outputs specified text to a file or window. Also erases the displayed window and message text.

MessageBox

Displays a specified message in a dialog box. Buttons or icons may be added. When the box has buttons, the command returns a value indicating which button the user clicked.

MessageEventLog (01-01)

Outputs a message to the application log in Event Viewer.

IMEventMessage (05-20)

Issues events to JP1/IM or JP1/Base. For details about the function of JP1/IM event console, see the manual JP1/Integrated Management - Manager Overview and System Design Guide.

Menu display

Menu (05-20)

Displays a user-defined window (menu form).

Calculations

+ operator (addition)

Finds the sum of two expressions.

+= operator (addition) (06-51)

Adds an expression to a variable, and assigns the sum to the variable.

- operator (subtraction)

  • Finds the difference between two numbers.

  • Reverses the sign of a numerical expression.

-= operator (subtraction and negation) (06-51)

Subtracts an expression from a variable, and assigns the difference to the variable.

Mod operator (remainder division)

Divides one number by another and returns the remainder.

Mod= operator (remainder division) (06-51)

Divides a variable by an expression, and assigns the remainder to the variable.

* operator (multiplication)

Finds the product of two numbers.

*= operator (multiplication) (06-51)

Multiplies an expression by a variable, and assigns the result to the variable.

/ operator (division)

Finds the quotient of two numbers and returns an integer.

/= operator (division) (06-51)

Divides a variable by an expression, and assigns the integer part to the variable.

\ operator (integer division)

Finds the quotient of two numbers and returns an integer.

\= operator (integer division) (06-51)

Divides a variable by an expression, and assigns the integer part to the variable.

^ operator (exponentiation) (06-00)

Raises one number to the power of another.

^= operator (exponentiation) (06-51)

Finds the exponentiation of a variable and an expression, and assigns the result to the variable.

Comparison operators (=, <>, <, <=, >, and >=)

Compares two expressions.

And operator (logical AND)

Finds the logical AND of two expressions.

Or operator (logical OR)

Finds the logical OR of two expressions.

Not operator (logical NOT) (06-00)

Finds the logical NOT of an expression.

Evaluations

IsEmpty

Checks whether a variable is an Empty value and returns True or False.

IsDefine or IsDef

Checks whether a variable is defined and returns True or False.

IsNumeric (01-01)

Checks whether a value can be evaluated as a numeric and returns True or False.

IsEmptyDir

Checks whether a folder is empty and returns True or False.

IsExistDir

Checks whether a folder exists and returns True or False.

IsExistFile

Checks whether a file exists and returns True or False.

IsWriteableDir

Checks whether a folder is writeable and returns True or False.

IsFileAttribute or IsFileAttr

Checks whether a folder or file has a specific attribute and returns True or False.

IsNew (05-10)

Compares which of two files has the more recent version or date, and returns True or False.

CheckDirName

Checks whether a folder name ends with a backslash (\).

CheckDriveType

Checks the drive type.

External program calls

Exec#

Calls an executable file. Multiple parameters may be specified.

NetExec (05-00)#

Calls an executable file on the local or remote PC. Multiple parameters may be specified.

WaitForExec (01-01)

Waits for completion or forcibly terminates an executable file called by the Exec or NetExec command.

GetExecStatus (06-00)

Gets the current execution status of an executable file called by the Exec or NetExec command.

CallSpt (06-71)#

Calls an SPT file as a procedure within the current process. Multiple parameters may be specified.

Automatic start

EntryStartUp (05-10)

Registers a script file for automatic startup.

CancelStartUp (05-10)

Cancels automatic startup for a script file.

Comment

Rem or ' (single quote)

Indicates a comment line in a program.

Other commands

Sleep

Halts script execution for a specified time.

Alert

Displays or clears user error icons in the Trace Viewer status bar.

Beep

Sounds a beep from the speakers. See 1.7.4 About the Beep command and the note in 8.13.3 Beep (sound a beep from the speakers) for details about using the Beep command.

Exit

Terminates script execution.

GetErrorMessage (01-01)

Returns the error message associated with a specified error detail code.

#: Table 8-2 shows the differences between the Exec, NetExec, and CallSpt commands.

Table 8‒2: Differences between the Exec, NetExec, and CallSpt commands

Command

Executable files

Wait for execution

Called external file process

Purpose

Feature

Environment variable

Exec

EXE file,

BAT file,

COM file,

SPT file,

CMD file,

and linked files

User can specify whether to wait for execution.

Executed in a new process.

The new process inherits a copy of the calling process and can therefore recognize the value of the environment variable at that process. However, any update of the variable is not reflected back at the calling process.

For calling an executable file.

NetExec

EXE file,

BAT file,

COM file,

SPT file,

CMD file,

and linked files

User can specify whether to wait for execution.

Executed in a new process.

The called executable file does not inherit the process environment variables of the calling process. Therefore, the values set in the calling side cannot be referenced.

For calling an executable file on a remote computer, or for calling an executable file and specifying whether it is to be executed in the Service space or logon space.

CallSpt

SPT file

Not specifiable (waits for execution by default).

Executed in the current process.

The environment variable is shared with the calling process and can be referenced. The calling process can also reference the updated value.

For calling an executable file as part of the current process.