Question : VBS - Help needed to modify the code

Hi,

Could somone help to to modifiy the following code so that:

1.) if the log entry is over 10 minutes (which is already in the script) then the script will wait for 20 minutes
then check for the same entry and if it is still over 10 minutes then trigger the following code below. If the log  entry is below 10 minutes then don't do anything.

Set objShell = CreateObject("WScript.Shell")
             varFile = Chr(34) & "C:\scripts\command.bat" & Chr(34)
            objShell.run "C:\Windows\System32\cmd.exe /c " & varFile
            Set objShell = Nothing

The second condition is "if the log file is not found" we need the script to wait 20 minutes then check again for the log and if not found then execute the following code (below) if the log exists then do nothing.

Set objShell = CreateObject("WScript.Shell")
             varFile = Chr(34) & "C:\scripts\command.bat" & Chr(34)
            objShell.run "C:\Windows\System32\cmd.exe /c " & varFile
            Set objShell = Nothing


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
'* FORMAT TODAYS DATE THAT PART OF THE LOG FILE NAME 
strYear = Year(TodayDT) 
strMonth = Month(TodayDT) 
strDay = Day(TodayDT) 
 
if CInt(strMonth) < 10 then 
    strMonth = "0" & strMonth 
end if 
if CInt(strDay) < 10 then 
    strDay = "0" & strDay 
end if 
 
strToday = strYear & strMonth & strDay 
' wscript.echo strToday 
 
Set objFSo = CreateObject("Scripting.FileSystemObject") 
pathname = "\\server\share\LOG for restarts_" & strToday & ".doc" 
if objFSo.FileExists(pathname) then 
Set objFile = objFSO.GetFile(pathname) 
strTime = objFile.DateLastModified 
 
        if isdate(strTime) then 
            DT = cdate(strTime) 
            DTN = Now 
                   if datediff("n",DT,DTN) > 10 then 
                    wscript.echo "Last log entry over 10 minutes" 
                   else  
                   wscript.echo "The system is still alive" 
                  end if 
 
      end if       
 
else 
         '* If the log file was not found. 
          'wscript.echo "Log file not found"
          'Send acommmand to the system
		 Set objShell = CreateObject("WScript.Shell")
		 varFile = Chr(34) & "C:\scripts\command.bat" & Chr(34)
		objShell.run "C:\Windows\System32\cmd.exe /c " & varFile
		Set objShell = Nothing
(...)

Answer : VBS - Help needed to modify the code

Click on Send Receive -> Send Receive Groups -> Define Send Receive Groups (at the bottom and may be what jrathi meant). Send Receive groups dialogue box opens. Send receive interval is in there. ... Thinkpads_User
Random Solutions  
 
programming4us programming4us