/* * $VER: virusz.dopus5 1.04 (12.05.99) * * ARexx script for DOpus 5.8+ * Fixed and enhanced for DOpus5.8+ by A Niven-Jenkins © 1999 Cremlin Software * Original script by Leo 'Nudel' Davidson * * Checks selected files and directories in the source lister * * ARexx: virusz.dopus5 {Qp} {Ql} * Flags: None * */ PARSE ARG dopusport sourcehandle . OPTIONS RESULTS OPTIONS FAILAT 99 SIGNAL ON syntax SIGNAL ON ioerr /* initial variable values */ lf='0a'x errorreport='' ADDRESS VALUE dopusport /* get selected entries list */ LISTER QUERY sourcehandle SELENTRIES STEM files /* only do if there is at least 1 selected entry */ IF files.count>0 THEN DO /* if VirusZ isn't loaded, load it */ IF ~SHOW('Ports', 'VIRUSZ_II.REXX') THEN DO ADDRESS COMMAND 'Apps:VirusZ/VirusZ' 'SYS:RexxC/WaitForPort VIRUSZ_II.REXX' END END /* only do if VirusZ is actually running */ IF SHOW('Ports', 'VIRUSZ_II.REXX') THEN DO ADDRESS VALUE dopusport /* set source lister to busy */ LISTER SET sourcehandle BUSY ON /* get path */ LISTER QUERY sourcehandle PATH listerpath=RESULT /* setup progress bar */ LISTER SET sourcehandle NEWPROGRESS TITLE NAME FILE BAR ABORT LISTER SET sourcehandle NEWPROGRESS TITLE "Checking..." LISTER SET sourcehandle NEWPROGRESS FILE files.count 0 LISTER SET sourcehandle NEWPROGRESS BAR files.count 0 /* check all selected entries */ DO counter=0 TO files.count-1 /* was abort clicked */ LISTER QUERY sourcehandle ABORT /* if it wasn't carry on */ IF RESULT=0 THEN DO /* create complete file path */ filepath=listerpath || files.counter /* update progress bar */ LISTER SET sourcehandle NEWPROGRESS NAME files.counter LISTER SET sourcehandle NEWPROGRESS FILE files.count counter+1 LISTER SET sourcehandle NEWPROGRESS BAR files.count counter+1 /* type of entry, >0 directory, <0 file, =0 error */ LISTER QUERY sourcehandle ENTRY files.counter STEM fileinfo /* pass entry to VirusZ */ SELECT WHEN fileinfo.type>0 THEN ADDRESS VIRUSZ_II.REXX CHECKDIR '"'filepath'"' DECREXEC DECRDATA USEEXTERN EXTRACT WHEN fileinfo.type<0 THEN ADDRESS VIRUSZ_II.REXX CHECKFILE '"'filepath'"' DECREXEC DECRDATA USEEXTERN EXTRACT WHEN fileinfo.type=0 THEN DO LISTER REQUEST sourcehandle '"Error: LISTER QUERY format has changed." OK' CALL endpart END END /* unable to check entry */ IF RC=10 THEN LISTER REQUEST sourcehandle "'Error: VirusZ could not check" || lf || filepath"' OK" /* entry is infected */ IF RC=5 THEN DO errorreport=errorreport || lf || filepath COMMAND FLASH END /* unselect entry */ LISTER SELECT sourcehandle files.counter OFF END END /* display error report */ IF errorreport~=='' THE DOPUS REQUEST '"Infected file(s): ' || lf || errorreport || '" _OK' /* on error */ syntax:;ioerr:;endpart: /* clean up */ LISTER SET sourcehandle NEWPROGRESS OFF LISTER REFRESH sourcehandle LISTER SET sourcehandle BUSY OFF /* close down VirusZ */ ADDRESS VIRUSZ_II.REXX QUIT END /* end gracefully */ EXIT 0