image\bbj40.gif OPEN Verb - Open File BBj


Syntax

OPEN (channelno{,MODE=string}{,ERR=lineref})alias

Description

For this topic's original documentation, see OPEN Verb - Open File.

BBj supports third party ‘plugin’ file types. The developer can define a new file type by writing Java classes that implement the interfaces com.basis.plugin.FilePlugin and com.basis.plugin.FileOpenPlugin. For more information, see Java API for BBj.

If the user has written the following Java classes:

com.userFileType implements FilePlugin
com.userFileTypeOpen implements FileOpenPlugin

and has defined the following alias in the current config.bbx file:

alias J0 com.userFileTypeOpen

then the new file type may be opened using the following syntax:

OPEN (channelno{,MODE=string}{,ERR=lineref})"J0"

All READs and WRITEs to the channel will then be delegated to the Java code in com.userFileType.

For further plugin code samples, go to <bbj install dir>/demos/plugins, or see BBj Filesystem Plugin.

For additional information about opening a printer, see Printing in BBj.

Mode

Value

Description

CRYPTALG=

AES-128

AES-256

Uses AES-128 bit encryption, which is also the default.

In BBj 6.0 and higher, and (V)PRO/5 6.0 and higher, uses AES-256 bit encryption.

BBj-Specific MODE Options

SYSGUI Mode

Description

ANTIALIASED=[ON|OFF]

In BBj 5.0 and higher, enables and disables font-enhancement technology, which makes screen fonts appear smoother and clearer on some displays. The default setting is ON (enabled).

File Mode

Description

TRIGGER

Only valid when opening a file from inside a file trigger. This option tells BBj to open a channel to the same open file handle that fired the trigger. This makes it possible to change the current position in the file that fired that trigger, from within the trigger. This also tells BBj to leave the actual file handle that fired the trigger, open after executing the trigger code.

Example 1

Open a channel that READ/WRITEs to the Windows Registry:

REM Demo using the Registry plugin. This plugin is Windows specific as it
REM opens/reads/writes/creates registry keys and values.

REM Assume the following aliases in the config.bbx file:
REM ALIAS J1A com.basis.plugin.RegOpenPlugin "SOFTWARE\\BASIS"
REM ALIAS J1B com.basis.plugin.RegOpenPlugin "SOFTWARE\\BASIS\\TESTKEY"

LET chan = UNT

REM Open the registry key using the plugin.
OPEN(chan,mode="key=HKEY_LOCAL_MACHINE,access=KEY_CREATE_SUB_KEY")"J1A"

REM Write a value for the registry key
WRITE RECORD(chan,key="TESTKEY")"This should be a subkey"

REM CLOSE the registry key.
CLOSE(chan)

REM Open the registry key using the plugin.
OPEN(chan,mode="key=HKEY_LOCAL_MACHINE,access=KEY_WRITE")"J1B"

REM Write a value for the registry key
WRITE RECORD(chan,key="TESTVALUE")"This is registry test"

REM CLOSE the registry key.
CLOSE(chan)

REM Open the registry key using the plugin.
OPEN(chan,mode="key=HKEY_LOCAL_MACHINE,access=KEY_READ")"J1B"

REM Read a value of a registry key
READ RECORD(chan,key="TESTVALUE")RECORD$

REM PRINT out the registry value.
PRINT "HKEY_LOCAL_MACHINE/SOFTWARE/BASIS/TESTKEY = " + RECORD$

REM CLOSE the registry key.
CLOSE(chan)

REM Open the registry key using the plugin.
OPEN(chan,mode="key=HKEY_LOCAL_MACHINE,access=KEY_SET_VALUE")"J1B"

REM Remove the registry value
REMOVE(chan,key="TESTVALUE")

REM CLOSE the registry key.
CLOSE(chan)

REM Open the registry key using the plugin.
OPEN(chan,mode="key=HKEY_LOCAL_MACHINE,access=KEY_ALL_ACCESS")"J1A"

REM Remove the registry key
REMOVE(chan,key="TESTKEY")

REM CLOSE the registry key.
CLOSE (chan)

Example 2

Open a channel that READ/WRITEs to a simple Hashmap:

REM This simple plugin stores key/value pairs in a in-memory Hashmap
REM Assumes the following alias in the config.bbx file:
REM ALIAS J2 com.basis.plugin.HashOpenPlugin

OPEN (22)"J2"
WRITE (22,KEY="10")"October"
READ (22,KEY="10")A$
PRINT A$