File: D:/bin/scripts/StockSnapshot.vbs
' (SS,30/05/12) stock snapshots run at a scheduled time (see Control Panel for actual schedule)
' (SS,27/07/17) added s to http, HF now HTTPS (at line 13, LURL =)
' (SS,28/08/21) added CIRC & VDK, also added Sub StockCheckLog for CIRC
' (SS,08/09/21) added StockCheckLog for VDK and HF (time in schedule changed from 01:00:00 to 23:59:50, i.e. end of day results)
AddLog ""
' (SS,28/8/21) added following
Call StockSnapshot("www.castironradiatorcentre.co.uk")
Call StockCheckLog("www.castironradiatorcentre.co.uk")
Call StockSnapshot("www.vintagedoorknobs.co.uk")
' (SS,08/9/21) added following
Call StockCheckLog("www.vintagedoorknobs.co.uk")
Call StockSnapshot("www.hyperflight.co.uk")
' (SS,08/9/21) added following
Call StockCheckLog("www.hyperflight.co.uk")
Sub StockSnapshot(AWebsite)
On Error Resume Next
Dim objRequest
Dim LURL
Set objRequest = CreateObject("Microsoft.XMLHTTP")
LURL = "https://" + AWebsite + "/stock-snapshot.asp"
AddLog "1. Started: " & LURL
objRequest.open "GET", LURL, False
objRequest.send
AddLog "2. Finished: " & LURL
Set objRequest = Nothing
End Sub
' (SS,28/8/21)
Sub StockCheckLog(AWebsite)
On Error Resume Next
Dim objRequest
Dim LURL
Set objRequest = CreateObject("Microsoft.XMLHTTP")
LURL = "https://" + AWebsite + "/stock-check-log.asp"
AddLog "1. Started: " & LURL
objRequest.open "GET", LURL, False
objRequest.send
AddLog "2. Finished: " & LURL
Set objRequest = Nothing
End Sub
Sub AddLog(AMessage)
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("D:\Logs\Stock Snapshot\StockSnapshotLog.txt", 8, True)
f.WriteLine(Now & " - " & AMessage)
f.Close
Set f = Nothing
Set fs = Nothing
End Sub