home *** CD-ROM | disk | FTP | other *** search
- Program Auto_Re_Search;
- {
- AutoReSearch v1.0
- This script automatically starts search process only for not searched hosts every
- specified time period specified count times after every search that was started
- not by AutoReSearch itself
- }
-
- const REMAINS_RE_SEARCH_PERIOD = 5;//In minutes, interval between starting of
- //re-searching on still not searched hosts
-
- const REMAINS_RE_SEARCH_COUNT = 5;//How many times start new re-searching on not searched
- //hosts after one external global search finished
- //If -1 then not limited
-
- //Be carefull with this settings to exclude
- //starting of re-search process on time
- //when global search should be started
- //If re-search is active then global earch
- //will not be started automatically
-
-
- var DisabledHostTable,MyDisabledHostTable,SearchedHostTable:TStringList;
- i,v,v1,v2,MyStartCounter:integer;
- StartedByMe,AutoImportAll,AutoImportOnline:boolean;
- Begin
-
- DisabledHostTable:=TStringList.Create;DisabledHostTable.CaseSensitive:=false;
- MyDisabledHostTable:=TStringList.Create;MyDisabledHostTable.CaseSensitive:=false;
- SearchedHostTable:=TStringList.Create;SearchedHostTable.CaseSensitive:=false;
- StartedByMe:=false;
- if REMAINS_RE_SEARCH_COUNT>0 then MyStartCounter:=REMAINS_RE_SEARCH_COUNT
- else MyStartCounter:=0;
- SetTimer(REMAINS_RE_SEARCH_PERIOD*60000);
-
- repeat
- v:=WaitEvent(v1,v2);
- if v=8 then
- begin
- if (not StartedByMe) and ((NVSearcher.GetStatus and 1)=0)
- and ((REMAINS_RE_SEARCH_COUNT<0) or (MyStartCounter<REMAINS_RE_SEARCH_COUNT))then
- begin
- AutoImportAll:=NVSearcher.HostTable_AutoImportAll;
- AutoImportOnline:=NVSearcher.HostTable_AutoImportOnline;
- NVSearcher.HostTable_EnumSearchedHosts(SearchedHostTable);
- if MyStartCounter=0 then
- begin
- NVSearcher.HostTable_EnumDisabledHosts(DisabledHostTable);
- MyDisabledHostTable.Assign(DisabledHostTable);
- end;
-
-
- if SearchedHostTable.Count<>0 then
- for i:=0 to SearchedHostTable.Count-1 do
- if MyDisabledHostTable.IndexOf(SearchedHostTable.Strings[i])=-1 then
- MyDisabledHostTable.Add(SearchedHostTable.Strings[i]);
-
- NVSearcher.HostTable_AutoImportAll:=false;
- NVSearcher.HostTable_AutoImportOnline:=false;
- NVSearcher.HostTable_SetDisabledHosts(MyDisabledHostTable);
- MyStartCounter:=MyStartCounter+1;
- StartedByMe:=true;
-
- NVSearcher.Start;
- end;
- end else if (v=NMNP_ALERT) and (v1=NVALERT_NETSEARCHER) and (v2<=0) then
- begin
- if StartedByMe then
- begin
- NVSearcher.HostTable_AutoImportAll:=AutoImportAll;
- NVSearcher.HostTable_AutoImportOnline:=AutoImportOnline;
- NVSearcher.HostTable_SetDisabledHosts(DisabledHostTable);
- StartedByMe:=false;
- end else MyStartCounter:=0;
- end;
- until v=0;
-
- SetTimer(0);
- DisabledHostTable.Free;
- MyDisabledHostTable.Free;
- SearchedHostTable.Free;
- End.
-