Here are some ways to facilitate scripting.
4.8.1. Copying a complete tutorial
The code
from DataHub tutorials can be copied directly from the text
into the Script Editor. Here's how to make a new script
from a complete tutorial.
- Open the DataHub Properties window and select the
Scripting option.
Click the New button. This dialog will appear:
- In the New class: field, enter
a name of your choice.
- Click the OK button to create
the file. The Script
Editor will open, displaying a script template.
- Using the cursor or
Ctrl-A, select all the
text and delete it.
- Copy a complete tutorial from the DataHub Windows
Help manual or online documentation into the Script
Editor.
- Save and run the script using the blue arrow icon
.
4.8.2. Setting up a scripting environment
If
you are working on one script regularly and need to restart
the DataHub often, here's a way to automatically open the
Properties window, the Script Log and the Script Editor with
your file loaded.
- Open the Properties window and Script Log.
- Position them on the screen, then close them.
They will come up in the same place the next time you
open them. (The Script Editor does not yet have this
feature.)
Write a script of these three lines:
datahub_command ("(show_properties 1)");
datahub_command ("(show_script_log 1)");
edit_file ("c:\\projects\\myfile.g");
Two slash marks (\\) are
necessary—the first slash mark escapes the second
one.
- Add this script to the list of scripts in the
DataHub, and check the activation box beside it. Then
next time you start the DataHub, the properties and
script log windows will come up where they were before,
and an editor will be opened on the file
c:\projects\myfile.g.
When you don't want the script to
auto-load, just un-check the activation box.