Arbortext Command Language > Using the Arbortext Command Language > A Further Modification
  
A Further Modification
You may want to add another if/else command to the commands shown in the Test the location of a document example. Using the pwd command to print the working directory slows things down a little bit. In some cases, the value of the variable $dirname is already the complete path. You can speed things up in some cases by checking to see whether the value of $dirname is already a complete path and if it is, using it as the value for $workingdir:
if (substr($dirname,1,1)=='\') {
$workingdir=$dirname;
} else { $workingdir= `pwd`;}
if (index($wd,'conf')!=0 && $doctype==memo) {
modify_tag -global document \
scilevel=secret;}
$dirname is a predefined Arbortext Editor variable. Its value is the name of the current document directory. The initial if/else command uses the substr function to find out whether the directory name begins with a backslash (\). If the name does begin with a backslash, the value of $dirname is a complete path, in which case it can be used as the value for $workingdir. If the name does not begin with a slash, the status of the index function will be 0, the initial if condition will not be true, and the else clause is invoked, calling pwd to get the complete path.