;Fetch most recent Capture File name ;**************************************************************************** ;* CAPNAME.WAS * ;* Copyright (C) 1994 Datastorm Technologies, Inc. * ;* All rights reserved. * ;* * ;* Written by: Larry Dorman * ;* * ;* The command FETCH CAPTURE FILE FILENAME no longer returns the most * ;* recent Capture File name, but the default Capture File name instead. * ;* This script will check the CAPTURE directory, determine what file is the* ;* newest and return the filename in the variable CapName. If no Capture * ;* files exist then [ None ] will be returned. * ;* * ;* This ASPECT SCRIPT is intended only as a sample of ASPECT * ;* programming. DATASTORM makes no warranty of any kind, express or * ;* implied, including without limitation, any warranties of * ;* merchantability and/or fitness for a particular purpose. Use of * ;* this program is at your own risk. * ;**************************************************************************** ;**************************************************************************** ;* Define Section * ;**************************************************************************** #define SearchString "C:\PROWIN2\CAPTURE\*.*" ;Path to Capture Files and file spec ;**************************************************************************** ;* Global Variable Declarations * ;**************************************************************************** string CapName ;The most recent Capture File name ;**************************************************************************** ;* MAIN () * ;* * ;* This procedure will compare all of the files in the defined Capture File * ;* directory and store the name of the newest one in the variable CapName. * ;* For demonstration purposes, the name of the file will be displayed in a * ;* Window's user message as well. * ;* * ;* Calls: None * ;* Modifies Globals: CapName * ;**************************************************************************** proc Main long Newest ;Maintain date/time for newest file found CapName = "[ None ]" ;Default to [ None ] for Capture name if findfirst SearchString ;Find the first Capture file Newest = $FLTIME ;Get the first file's date/time info CapName = $FILENAME ;Get the first file's name while findnext ;Find the next Capture file if $FLTIME >= Newest ;Is this ones date/time newer? Newest = $FLTIME ;Get the new file's date/time info CapName = $FILENAME ;Get the new file's file name endif endwhile endif usermsg "%s" CapName ;Display name of newest Capture File endproc