DiveBook Functions in DIAL
The divebook functions in DIAL access and manipulate DiveBooks on a DiveLine server.
Returns the number of areas contained in the DiveBook that is stored in the special Object Variable divebook.
Returns the name of the area at the specified index, area_index, in the specified special Object Variable divebook. The value of area_index should be an integer between 1 and the number of areas in the DiveBook.
Deletes the area, area, from the specified DiveBook, divebook. All topics in the area are deleted from the DiveBook.
Deletes the named topic in the named area from the DiveBook that is stored in the special Object Variable divebook.
Opens a DiveBook with the DiveLine name filename from the DiveLine server, and assigns it to the DiveBook that is stored in the special Object Variable divebook. If the DiveBook cannot be opened, the DIAL script ends.
Opens a Marker or DivePlan named topic in the named area of the DiveBook stored in the divebook special Object Variable. The Marker or DivePlan is assigned to the Model special Object Variable model. If the Marker or DivePlan cannot be opened, the DIAL script ends.
Returns the link_name for the specified link topic identified by the named topic and area. If the specified topic is not a link topic, this function returns null.
Saves the DiveBook that is stored in the DiveBook special Object Variable divebook to a file on the DiveLine Server named filename.
Saves the DivePlan that is stored in the Model special Object Variable model to the DiveBook stored in the DiveBook special Object Variable divebook in the named topic and area.
Saves the bottom-most window in the Model stored in the special Object Variable model to the DiveBook stored in the DiveBook special Object Variable divebook in the named topic and area.
Returns the type of the named topic in the named area of the DiveBook stored in the divebook special Object Variable. This function returns one of four possible values: DivePlan, Marker, Link, or Unknown. The function returns Unknown if the area or topic does not exist.
Returns the number of topics for the named area in the DiveBook special Object Variable divebook.
Returns the name of the topic that is stored in the topic_index in the specified DiveBook area. The topic_index should be an integer between 1 and the number of topics in the area.
NOTE: The divebook.save function must be used to save DiveBook changes to disk.
The following examples demonstrate the use of DiveBook functions.
diveline.connect("myserver", "dial_user");
diveline.set_project("myProject");
divebook.open(divebook,"/models/divebook.dbk");
console.writeln ("This DiveBook has \t" + divebook.area_count(divebook) + "\tAreas");
console.writeln ("Area five is called:\t" + divebook.area_name(divebook,5));
console.writeln ("The Reports area has \t" + divebook.topic_count(divebook,"Reports") + "\tTopics");
console.writeln ("The Top Suppliers topic in the Reports area is" + " a:\t" + divebook.topic_type(divebook,"Reports", "Top" + " Suppliers"));
divebook.open_topic(divebook, model,"Reports", "Top Suppliers");
divebook.save_diveplan(divebook, model, "Reports", "Supplier" + " Report DivePlan");
divebook.save_marker(divebook, model, "Reports", "Supplier" + "Report");
divebook.save(divebook,"/temp/divebook.dbk");
diveline.disconnect();
diveline.connect("myserver", "dial_user");
diveline.set_project("myProject");
divebook.open(divebook,"/models/divebook.dbk");
console.writeln ("This DiveBook has \t" + divebook.area_count(divebook) +"\tAreas");
console.writeln ("Area three is called:\t" + divebook.area_name(divebook,3));
console.writeln ("The Reports area has \t" + divebook.topic_count(divebook,"Reports") + "\tTopics");
console.writeln ("The Customer Shipments Report topic in the Reports area is a:\t" + divebook.topic_type(divebook,"Reports", "Customer Shipments Report"));
divebook.open_topic(divebook,model,"Reports", "Customer Shipments Report");
divebook.save_diveplan(divebook, model, "Reports", "Customer Shipments DivePlan");
divebook.save_marker(divebook, model, "Reports", "Customer Shipments Marker");
console.writeln ("The Reports area now has \t" + divebook.topic_count(divebook,"Reports") + "\tTopics");
divebook.save(divebook,"/models/temp_divebook.dbk");
diveline.disconnect();