Did you know ...?

#11: Creating your own wizards

You may have noticed the "Wizard" menu at the top of the GHS window. This menu offers a collection of smart dialog box systems that help you perform several tasks. These wizards are arranged in categories such as "Geometry" and "Conditions". There's also a catchall category where "All" wizards in the system are listed alphabetically. After opening a category, you can select a wizard and "Run" it.

Did you know that you can create your own wizards and add them to the "Wizard" menu? A wizard is just a run file located in the GHS program directory with an appropriate file name and extension.

Normally a wizard run file defines and executes a series of TEMPLATE dialog boxes that gather information, and then accomplishes tasks when buttons tied to MACROs are pushed by the user. If you are not familiar with the TEMPLATE command, it is fully documented in the TEMplate help topic (use the Help pulldown menu to access this, or type HELP TEMPLATE at the command prompt). Then take a stab at writing a simple wizard run file, either from scratch or by copying and pasting code from existing wizards. (See below for an example.)

Once you have a new wizard run file that you'd like to test, give it a file name that matches how you want its description to appear in the "Wizard" menu list. At the end of the file name, there should be the extension ".WIZ" followed by a two-letter category code. The following codes are pre-defined:

GF - Geometry
CR - Criteria
TA - Tables
LI - Light Ship
CO - Conditions
SA - Salvage
MY - My wizards

You can either assign your new wizard an extension that will group it with others in its category (for example, "Arrange Cargo.WIZCO" will be put in the Conditions listing) or else end your wizard name with ".WIZMY" to put it in your own personal "My wizards" collection. You can also categorize "My wizards" by putting them in a separate Library Path directory, which allows them to have other extensions besides ".WIZMY" (e.g. ".WIZGF"). The Library Path can be set using the File -> Setup paths -> User library menu selection or the MESSAGE LIBPATH command.

Once you've got your wizard working, you can share it with other GHS users so they can put it in their own GHS program directory. If you'd like to keep private the inner workings of your wizard and prevent others from editing it, you can do so by coding your wizard file using the COPY /CODE command before distributing it.

`Simple wizard example

variable wantcg=1

macro LE
 if "{GF}"="" then error "No geometry file has been read"
 variable (str) s
 if {wantcg}<>0 then set s="/CG"
 load (*) edit {s}

template LoadEdit "Ready to edit loads"
  "Current geometry file: {GF}"
  "Include Condition Graphics_" check wantcg
  "Edit loads" exit LE
  "Cancel" exit



Copyright (C) 2012 Creative Systems, Inc.