home *** CD-ROM | disk | FTP | other *** search
- // Enable LOG ON for debugging purposes since it will
- // show the lines processed and their structure.
- // (Remove the leading slashes to enable LOG ON)
-
- // LOG ON
-
-
- // Change to the System Console screen before processing.
-
- CHANGE_SCREEN "System Console"
-
-
- // Clear the System Console screen.
-
- CLS
-
-
- // The following displays the currently mounted volumes
- // and their space usage on the console screen.
-
- VOLINFO
-
-
- // Capture the current System Console screen image as
- // text (default mode).
-
- SAVE_SCREEN SYS:SYSTEM\CONSOLE.DAT
-
-
- // Open the System Console screen text image for input.
-
- OPEN_READ SYS:SYSTEM\CONSOLE.DAT
-
-
- // This WHILE/LOOP scans for the string "Mounted Volumes"
- // in each line of the captured System Console screen.
- // Mounted Volumes is displayed on the line preceding
- // the Volume names shown by the VOLUMES console command.
- // (Note: The first pass fails since %1 is not defined.)
-
- WHILE NOT SCAN_STRING "Volume Name" "%1"
-
-
- // The "Volume Name" string was not found so read the next
- // line from the input file (System Console screen text image).
-
- READ %1
-
-
- // Abort the Task if a read error occurs.
-
- IF ERRORLEVEL
- ECHO Read error occurred!
- ABORT
- ENDIF
-
-
- // If the read returns a null string, exit since the
- // System Console screen should be padded with spaces.
- // (Note: No spaces are allowed between the strings and
- // the operators in comparisons.)
-
- IF "%1"==""
- ECHO Unable to locate volume information!
- ABORT
- ENDIF
-
-
- // Repeat the process until "Volume Name" or a null string.
-
- LOOP
-
-
- // The following WHILE/LOOP tests if the read string is null
- // The first pass it will not be since it matched above.
- // (Note: No spaces are allowed between the strings and the
- // operators in comparisons.)
-
- WHILE "%1">""
-
-
- // Read the next line from the captured System Console screen
-
- READ %1
-
-
- // Abort the Task if a read error occurs.
-
- IF ERRORLEVEL
- ECHO Read error occurred!
- ABORT
- ENDIF
-
-
- // If the string "%" is not found on the line, must be
- // out of volumes since ##% would appear as Used/Free.
-
- IF NOT SCAN_STRING "%" "%1" THEN BREAK
-
-
- // The following uses a quirk in the CD/CHDIR command:
- // Since a space is not a valid volume/path character,
- // the parser will ignore any trailing characters after
- // the specified volume/path.
-
- CD %1
-
-
- // At this point, the .TSK has changed the Current Working
- // Directory (CWD) to the root of the (first/next) volume.
- // Another .TSK could be launched to walk the directory
- // tree and delete old/backup files, etc. or the logic
- // could be incorporated herein.
-
- // For this example, we will merely display the CWD.
-
- ECHO Successfully changed to %CWD%
-
-
- // Repeat the process until "%" is not found or a null string
- // is encountered (indicating an End Of File).
-
- LOOP
-
-
- // Clean up our work file.
-
- DEL SYS:SYSTEM\CONSOLE.DAT
-
-
- // Disable LOG ON (if previously enabled).
- // (Note: This is not required since TaskMaster will
- // clean up after the Task but it is a sign of
- // proper design and follow through in the logic.)
-
- // LOG OFF
-