D&Do v. 1.0 Prev Next Top
Adapting the Metascript to the Script
Using Notepad, let us open the DirCreate.ms metascript. We certainly recognized some of its content that has been manifested as a variant name and as a drop tag ID.
Let us modify the metascript for our own application. Edit the following lines:
- From DN:2
to DN:1
Since only one tagged drop is needed
- From EXEC:
To EXEC:pythonw.exe
Since we need the Python interpreter
- From ARG: test.py *#
To ARG: tutorial\DirCreate.py "*0" *# -C
Since we want to use the DirCreate.py python script. The first argument is filled with the content of the first tagged drop (variable *0). The second argument is filled with one drop item that is part of the non-tagged collection (variable *#). The switch -C is placed here as the default switch; it tells the script to effectively create the subdirectory.
Note: All untagged drops that will replace the template variable *# will be put between quotes individually because of the template parameter DKOTE:1. The quotes should be typed explicitly for arguments that are associated with tagged drops.
- From ARGID1: Variant 1
To ARGID1: To_Clipbrd
The first named variant is used to put the subdirectory name into the system clipboard, let us name it appropriately. The name should be short.
- From ARG1: test.py "*0" -C *#
To ARG1: tutorial\DirCreate.py "*0" *# -P
Similar as for ARG: parameter but using the -P switch to tell the script to put the subdirectory name into the system clipboard.
- From ECODE:10 ERR: Bad switch arg
To ECODE:14 ERR: Unable to create
Since the script might not be able to create the subdirectory, it will exit with the value 14. We can examine the source code of the script and find where it generates such exit code. You may add other exit code messages, if you want.
Remove the following lines:
- DH:1 Spec file
No second tag; no name for it
- DT:1 FIL
No second tag; no drop type for it
- ARGID2: Variant 2
No variant associated with '2' key; no name for it
- ARG2: testp.py "*0" "*1" -U
No variant associated with '2' key; no argument list for it
This is it! The metascript is ready. Let us experiment with it.
Prev Next Top
Copyright (c) 2003 Marcel St-Amant