D&Do v. 1.0   Prev   Next   Top


Metascript Exploration

Note: This example illustrates the concepts introduced in the sub-section How D&Do Works; a Summary. End users who read this document for the first time may skip this section.

Let us explore the metascript file. It is easy to understand, as you will see.

 Note: The file separator character used in the examples is the forward slash "/"; it works for Windows, Linux and UNIX.

Using a simple text editor (e.g. the simple Windows Notepad), open the "FNamerDrag.ms" file (a metascript file; the one used for the file name generator example). Each line contains either a comment (lines starting by the '#' character) or a parameter. The first line must start by "[metascript]"; this line should not change. Each parameter is identified by a variable ID (an all-capital-lettered word), followed by a colon then by the value. Some variables contain simple values (e.g. a number or a text), some variables contain pair of values (a number followed by a text). The order of these parameter lines is not important but the variable ID must be at the beginning of the line.

The two most important parameters are:

Let us suppose that you have chosen the statement "Big Feet Software " from the Web page and, drop it into the target area. D&Do will resolve the argument list as follows:
scripts/py/FNamer.py "Big Feet Software"
It will append the above text to the path name of the executable file then it will type the resulting text, as a command, for you:
pythonw.exe scripts/py/FNamer.py "Big Feet Software"

The script will transform the statement into a valid HTML file name then it will print it into the terminal (the normal output) as:
BigFeetSoftware.htm

D&Do will collect that output and place it into the system clipboard, ready, for you. I am using a simple example, but imagine situations where a script requires many arguments.

Let us continue the exploration by examining the important basic behavior parameter of the metascript file; it accepts a digit between 0 and 8.

It is time here to do some experiment.

Edit the file by changing the value of BB to 3 (BB:3). Save the metascript then, from D&Do, reload the metascript (using its popup menu item: "Load Metascript"). You get the following display:

You have a similar display with the exception that the target area displays "DO". D&Do will use the same script but requires that you have to click the target area for starting the script. Try it. You have slightly changed the D&Do behavior, but, as you have realized, with this setting, the usage of the FNamer.py script is not as efficient.

Let us explore a little more. Do the following changes in the FNamerDrag.ms file, as follows:

Save the metascript then, from D&Do, reload the metascript (using its popup menu item: "Load Metascript"). You get the following display:

The target area is now gray, which means that D&Do does not accept any drop. Try it; you will get an error message on the status line. The "DO" means that the D&Do activity will be triggered when you click on the target area. As you expect, you have to copy a statement into the clipboard then to click the target area in order to get the correct file name into the clipboard (it had replaced the statement you have put there initially). You can then use the clipboard to paste the file name into a File name text field of a "Save As" dialog box. That box may be related to any application.

Here also, it seems that this is even a less efficient way of using the FNamer.py script. However, there are Windows applications that do not allow for dragging a text fragment; a good example is the Windows Notepad. If you have to extract statements from such application, this configuration of D&Do is then the best one under such circumstance. It still saves you from editing the file name.

This tour shows us that D&Do can provide many ways for us to interact graphically with the SAME command line script. That "way of interaction -- its behavior" is configured from the metascript file. We just adjust it to our own taste and for our own working situation.

Command line scripts are much easier and faster to create that a GUI-based (Graphical User Interface) one. If you have some programming skill (e.g. using the Basic language), you can create your own script in less than one hour. You then integrate it with the help of its associated metascript; just start from a template provided in the script/template subdirectory. You invest an hour, you save later from 10 and more minutes a day, every day. The Tutorial sub-section will go exactly through such a process.

To save you more time, you can position D&Do closer to your source application. You can also either increase or reduce the target area. This way, you reduce mouse-travelling requirements and reduce strain from the mouse operation. This strain can be reduced even more, you can stick D&Do on top of the desktop windows, with an external utility (ex. with the "Stay on Top" utility).

Before leaving this tour, re-edit the metascript, to its initial settings:

This ends the initial tour of D&Do and of a metascript. This tour gives you an idea of what D&Do does and of what is a metascript file. Before going to the Tutorial, it is preferable, at this point, to have a more detailed knowledge of D&Do. What followed next is the reference section of D&Do itself. After the Tutorial, there is a reference section for the metascript file detailed structure.

 

Conclusions from this section

We learned how to:

We experience most of the D&Do concepts. Also, we experience the relation between D&Do, the metascript, the program, dropped objects and the clipboard. We learned also how to recognize the D&Do behavior from its target area appearance and messages.

 


Prev   Next   Top

Copyright(c) 2003-2004 Marcel St-Amant