// GWIARSET.TSK // Author: Gregory M. Palumbo, CNE // Begun: 08-13-01 // // Purpose: This TSK works with GWIASTAT.TSK to reset the GWIA IN/OUT // counters on the first of every month. // // Overview: The GWIA gateway NLM keeps a running total on it's screen, but // unless you use the accounting feature and a third party app // to parse the accounting log files, you can't get a simple // chart showing the daily totals. Also, the counter never // resets so you have to remember to grab the totals every day. // What this script does is save the screen to a temp file every // day at the same time. Then it parses the file for the OUTBOUND // and INBOUND numbers and appends them to a monthly log in CSV // format. Then on the 1st of the month at 12:01AM, it activates // the GWIA screen and resets the counters by KEYIN statements. // // Dependancies: GWIASTAT.TSK, LOG file path must be the same in both files!! ////////////// Variables used /////////////////////// // %0 - Save initial working dir so it can be restored. // %6 - Comment string - This is basically used to // tell us why we don't have a // log entry for a given day. // %9 - Dead Loop counter ////////////// Variables used /////////////////////// // First save the Current Working Directory (CWD) DEFINE %0 %CWD% // %8 defines "last month" so we can put at end of last month's log... DEFINE %8 %MONTH%-=1 // Now define a new CWD (or default directory) where the // captured screen images and logs should be saved CD SYS:\SYSTEM\TASKMSTR\LOGS ECHO GWIARSET.TSK Starting... // Check if GWIA loaded. We will note this in the log if it isn't. IF NOT LOADED GWIA.NLM THEN BEGIN Define %6 "GWIA not loaded when running RESET_COUNTER in GWIARSET.TSK" OPEN_WRITE %CWD%\GWIA-%8.LOG WRITE "%MONTH%/%DAY%/%YEAR%",,,,,,%6 CLOSE ABORT ENDIF // Change to GWIA screen IF NOT CURRENT_SCREEN "GroupWise Internet Agent" CHANGE_SCREEN "GroupWise Internet Agent" SLEEP 1 IF ERRORLEVEL THEN ABORT ENDIF // Final check to make sure that the GWIA.NLM screen is the active screen IF NOT SCAN_STRING "Internet" "%SCREEN_NAME%" THEN ABORT // Turns on "Options" menu, should put a "F9-Stats" at the bottom of the screen. ECHO Turn on GWIA Options menu... // Dead Loop Counter... In case GWIA screen doesn't respond properly. DEFINE %9 03 WHILE Define %9 %9-=1 ECHO %9 IF %9<=0 THEN BREAK IF SCAN_SCREEN "F9-Stats" THEN BREAK KEYIN F10 // SLEEP for 1 second (to allow a busy system to activate the screen) SLEEP 1 LOOP // Cycles through screens until "SMTP Message statistics" is the current screen. // We don't want to keystuff the wrong screen! ECHO Find SMTP Stat sub-screen... // Dead Loop Counter... In case GWIA screen doesn't respond properly. DEFINE %9 8 WHILE Define %9 %9-=1 ECHO %9 IF %9<=0 THEN BREAK IF SCAN_SCREEN "Message Statistics" THEN BREAK KEYIN F9 // SLEEP for 1 second (to allow a busy system to activate the screen) SLEEP 1 LOOP // We should be in the right screen (SMTP message stats) by now... IF NOT SCAN_SCREEN "Message Statistics" THEN BREAK ECHO Found SMTP Stat sub-screen... // Reset the counters ECHO Resetting the SMTP stat counters... KEYIN F8 // Go back to Normal menu... ECHO Return to normal menu... KEYIN ESC ECHO GWIARSET.TSK Successful... Define %6 "GWIA SMTP Stat counters reset..." OPEN_WRITE %CWD%\GWIA-%8.LOG WRITE "%MONTH%/%DAY%/%YEAR%",,,,,%6 CLOSE // Return to intial working dir CD %0