D&Do v. 1.0   Prev   Next   Top


Exploring the Example Script

A DirCreate script has been written in Python, in Microsoft Visual Basic Script, in Microsoft JScript and in Java (PHP, C#, PHP). All these versions were built to demonstrate that D&Do can work with scripts of various programming languages. The script accepts three arguments:

The script will modify each illegal character of the statement into an underline character. The modified text can then be used as a valid directory name. The script will also replace each white character with a hyphen.

Let us experiment with the script directly in a Shell/DOS box. Type in the following command:
python tutorial\DirCreate.py C:\temp "my * favored"
it responds with
"my-_-favored"

That modified name "my-_-favored" may not fit your own taste but the script source has been kept as trivial as possible for this tutorial. We can modify that scrip to our taste later. If we add "-C" at the end of the command, a subdirectory will be created with the same modified name.

Windows TIP: You probably know, in order to save you time, you may drop directories and files directly into the DOS box. You cannot, however, drop text in such a box. To insert a text fragment, you can use the system clipboard. Copy a text from one of your applications then paste it using the paste icon of the DOS box (forget about the Ctrl-V key combination; it does not work there). It is a faster method than typing the text but not as convenient.

It would be more efficient if you can shorten and simplify your task as follows:

Wow! This is exactly what we plan to do by creating a proper metascript.

 


Prev   Next   Top

Copyright (c) 2003 Marcel St-Amant