D&Do v. 1.0   Prev   Next   Top


Using a Template Metascript

The best way to create a new metascript is to start from the metascript template file (Metascript.ms); it is located under the "scripts\templates" subdirectory. This template file is already configured for the basic-behavior seven (7), as described on the table of Target Area sub section. The first drop item must be tagged as the "Destination Directory" tag (or "Dest Dir") and will be placed as the first argument of the script. All other drops are text fragments that will be used for the second argument of the script, one fragment at the time. There will be two variants of the argument list: one with the "-C" switch (the default) and one with the "-P" switch.

We copy (make sure that we are not merely moving it) this template into the "tutorial" subdirectory. We rename it as: DirCreate.ms. Note: What follows applies to the python version only; look at the tutorial subdirectory for example solutions that apply to other script languages.

Let us experiment with this unmodified version of the copy of the template. Load it into D&Do; we see the following display.

The first drop D&Do expects is a directory and it is tagged as "A Dir". The next one it expects is a file and is tagged as "A file" then text fragments that are identified collectively (non-tagged) as "Text Drops". It behaves like that since this template has defined two tags. After dropping a few text fragments, we may click the target area. The results are:

While D&Do has the focus, let us press '1', then '2', then '3' then, 'a'. We see that the metascript had defined 3 variants; Variant 1, Variant2 and the default (and unnamed) variant. This last one is activated when we key-in an undefined key such as '3' or 'a' for that metascript.

TIP: Using a metascript with an empty EXEC parameter provides a way to view its resolved argument list with the help of the clipboard viewer. This feature is helpful for debugging metascript files.

 


Prev   Next   Top

Copyright (c) 2003 Marcel St-Amant