DiveLine Functions in DIAL

The diveline functions in DIAL manage connections to a DiveLine server.

Function Description

diveline.connect("server:port ", "user", "password")

Connects to the DiveLine server. The server can be referenced by a host name or an IP address. If no port is specified, DiveLine defaults to port 2130. Optionally, logs in with the specified user name and password, which must be enclosed in quotation marks. Only one DiveLine connection can be open in a particular script. A second DiveLine connection in a script causes the first connection, as well as any open Models, Markers, and DiveBooks, to be closed.

NOTE: Starting with DIAL 7.1(15), when in server mode, DIAL automatically connects to DiveLine as the DIAL user in Server Settings.

diveline.disconnect()

Disconnects from the current DiveLine server. All Models, Markers, and DiveBooks are automatically closed.

NOTE: Starting with DIAL 7.1(15), when in server mode, the script skips the diveline.disconnect() function and displays a warning.

diveline.impersonate_user("user")

Performs a proxy login. You must already be logged on to DiveLine as an administrator or subadministrator and be able to administer the specified user. If successful, all previously opened data is closed, and for the remainder of the script, you have the same access rights as the specified user. This is not valid inside a dive statement.

diveline.set_project("project")

Sets the project on the server. After setting the project, you can refer to files in the project by their absolute path inside the project. Any DiveLine files open before the set_project() function call are closed.

diveline.set_webdir(directory)

Sets the webdir directory used for Web Server authentication. The specified directory is used to communicate between the script generating the password and the DiveLine server, which checks the password.

To connect to DiveLine with web server authentication, begin each script with the diveline.set_webdir() function followed by the diveline.connect() function.

NOTE: If DIAL is run on the DiveLine server and has write access to the directory, the script generates this one-time password to log in. After this function is called, any diveline.connect() calls with a user and no password use this mechanism to authenticate the user regardless of the authentication scheme in place. This function eliminates the need to include the connect user’s password in the script in clear text.

NOTE: Starting with DIAL 7.1(15), when in server mode, the script skips the diveline.set_webdir() function and displays a warning.

Example:

diveline.set_webdir("/di/solution/dl-dataroot/webdir");

diveline.connect("localhost", "dial_user");

diveline.set_project("myProject");

 

console.writeln("Opening sales.dvp...");

model.open(mymodel,"/models/an_sales.dvp");

console.writeln("Done!");

 

diveline.disconnect();

 

NOTES:

  • If DiveLine files are open before the set_project function, those files are closed by that function call.
  • When connecting to a 7.x DiveLine server, if the set_project command is not specified in the DIAL script, the 6.4 Diveline Namespace project opens.
  • Once the project is set, refer to files in the project by their absolute path inside the project. For example:
  • marker.open(MARKER_,"/client-files/mthly.mrk");
  • Workbench resolves the path to a DIAL script in a project, so it can pass the local file system path to the DIAL interpreter, which then runs as in previous versions.
  • Certain functions use DiveLine paths (for example marker.save()) while other functions use local file system paths (for example marker.save_text()).