Command Group
<%'***** FUNCTIONS *****
Function ReadFileLN(FileName, tmpStr, lnNum)
Dim objFSO, strPath, tmpNum
strPath=Server.MapPath(FileName)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set FileName = objFSO.OpenTextFile(strPath, 1)
If lnNum=1 then tmpStr=FileName.ReadLine End If
If lnNum>1 then
For tmpNum = 1 to lnNum-1
If FileName.AtEndOfStream=False then
FileName.SkipLine
End If
Next
tmpStr=FileName.ReadLine
End If
Filename.Close
End Function
Function LinesInFile(FileName, lnCntr)
Dim objFSO, strPath, tmpNum
strPath=Server.MapPath(FileName)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set FileName = objFSO.OpenTextFile(strPath, 1)
lnCntr=0
Do while FileName.AtEndOfStream=False
lnCntr=lnCntr+1
FileName.SkipLine
Loop
Filename.Close
End Function
SUB GetMonthYear
Done=False %><% lnCnt2=1
LinesInFile FileToCheck, lnCnt1
Do until (lnCnt2=lnCnt1) or Done
ReadFileLn FileToCheck, tmpStr, lnCnt2
tmpStr=Server.HTMLEncode(tmpStr)
currMonth=""
For MCnt=1 to 12
MPresent=MonthName(MCnt)
MStart=Instr(1, tmpStr, MPresent, 1)
If MStart>0 then currMonth=MPresent End If
Next
If not currMonth="" then
MStart=Instr(1, tmpStr, currMonth, 1)
currYear=Mid(tmpStr, MStart+Len(currMonth)+1, 4)
MonthOut=currMonth
YearOut=currYear
Done=True
Else
lnCnt2=LnCnt2+1
End If
Loop
End SUB %>
<%'***** MAIN *****
DIM tmpStr, tmpNum, currYear, currMonth, MStart, MCnt, MPresent, lnCnt1, lnCnt2
DIM MonthOut, YearOut, Done
CONST FileToCheck="qm-update/QM2-General'sUpdate.html"
GetMonthYear
%>