Hitachi

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


9.2.1 RegRead (read a value from the registry)

Purpose

Reads a value from the registry.

Syntax
RegRead(RegKey, SubKey, ValueBuff, [EntryName], [TypeBuff] [, Option])
Arguments
RegKey

Specify the registry key as one of the following:

  • HKEY_CLASSES_ROOT

  • HKEY_CURRENT_USER

  • HKEY_LOCAL_MACHINE

  • HKEY_USERS

If you specify HKEY_LOCAL_MACHINE and specify Software for the first key of SubKey, the entry is redirected to HKEY_CURRENT_USER\Software\Classes\VirtualStore\Machine\Software. The redirected entry will be read preferentially.

SubKey

Specify the registry subkey as a character string or as a variable that stores this value.

ValueBuff

Specify a variable for storing the read value.

EntryName

Specify the entry as a character string or as a variable that stores this value.

This value is optional. If you omit this value, a value without an entry name is assumed.

TypeBuff

Specify a variable for storing the datatype.

This variable stores one of the following values:

  • REG_BINARY

  • REG_DWORD

  • REG_DWORD_BIG_ENDIAN

  • REG_EXPAND_SZ

  • REG_LINK

  • REG_MULTI_SZ

  • REG_NONE

  • REG_RESOURCE_LIST

  • REG_SZ

This value is optional.

Option

Specify one of the following optional values:

Value

Meaning

10

Return a decimal number if the value is of type REG_DWORD or REG_DWORD_BIG_ENDIAN.

16

Return a hexadecimal number if the value is of type REG_DWORD or REG_DWORD_BIG_ENDIAN.

This value is optional. If you omit this value, 16 is assumed.

Description

The RegRead command reads a value from the registry and stores it in the specified variable. The command returns True on successful execution, or False if an error occurs.

Important note

If the type of the registry that was read is REG_MULTI_SZ, only the value in the first line is stored in the variable.

If the registry value to be read contains 1,025 or more bytes, an error occurs and 0234 (More data is available.) is output. Do not attempt to read a registry value longer than 1,024 bytes.

Example
Dim DBflag
RegRead(HKEY_LOCAL_MACHINE   _
        ,"Software\Hitachi\JP1/Script\Option" _
        , DBflag, "Debug")
If  DBflag = 1  Then
  Exit
End
JP1/Script version

Supported from JP1/Script 01-00.