In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use scheduled tasks and VBS scripts to achieve automatic WEB sharing of files in the folder, the article is very detailed, has a certain reference value, interested friends must finish!
The code is as follows:
Option Explicit
On Error Resume Next
'generate the file type of the list
Const sListFileType = "wmv,rm,wma"
'relative path where the file is located
Const sShowPath= "."
'Const definition of sort type
Const iOrderFieldFileName = 0
Const iOrderFieldFileExt = 1
Const iOrderFieldFileSize = 2
Const iOrderFieldFileType = 3
Const iOrderFieldFileDate = 4
'The constant definition of sort order and inverse.
Const iOrderAsc = 0
Const iOrderDesc = 1
'The number of files that generate the list
Const iShowCount = 20
'The displayed date format function
Function Cndate2 (date1,intDateStyle)
Dim strdate,dDate1
Strdate=cstr (date1)
If Isdate (strdate) Then
If Left (cstr (strdate), 1) = "0" Then
DDate1=Cdate ("20" + cstr (strdate))
Else
DDate1=Cdate (strdate)
End If
Else
DDate1=Now ()
End If
Select case intDateStyle
Case 1:
Cndate2 = Cstr (Year (dDate1)) + "-" + Cstr (Month (dDate1)) + "-" + Cstr (Day (dDate1))
Case 2:
Cndate2 = Cstr (Month (dDate1)) + "-" + Cstr (Day (dDate1))
Case 3:
Cndate2 = Cstr (Month (dDate1)) + "month" + Cstr (Day (dDate1)) + "day"
Case 4:
Cndate2 = Cstr (year (dDate1)) + year + Cstr (Month (dDate1)) + month + Cstr (Day (dDate1)) + Day
End Select
End Function
Function ListFile (strFiletype,intCompare,intOrder,intShowCount)
Dim sListFile
Dim fso, f, f1, fc, s,ftype,fcount,i,j,k
Dim t1,t2,t3,t4,t5
Dim iMonth,iDay
SListFile = ""
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.GetFolder (sShowPath)
Set fc = f.Files
Fcount = fc.count
Redim arrFiles (fcount,5)
Redim arrFiles2 (fcount,5)
ITunes 0
'sort
For Each f1 in fc
Ftype = right (f1.name f1.name Len (f1.name)-instrrev (f1.name, ".")
ArrFiles (iPermine 0) = f1.name
ArrFiles (iPermine 1) = ftype
ArrFiles (iMagne2) = f1.size
ArrFiles (iBER3) = f1.type
ArrFiles (iB4) = f1.DateLastModified
I=i+1
Next
For iTunes 0 to fcount-1
For j=i+1 to fcount-1
Select Case intCompare
Case iOrderFieldFileName,iOrderFieldFileExt,iOrderFieldFileType:
If arrFiles (iMagneintCompare) > arrFiles (jPowerintCompare) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
Case iOrderFieldFileSize:
If cdbl (arrFiles (iMenintCompare)) > cdbl (arrFiles (jPowerintCompare)) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
Case iOrderFieldFileDate:
If Cdate (arrFiles (iMenintCompare)) > Cdate (arrFiles (jPowerintCompare)) then
T1 = arrFiles (iPerin0)
T2 = arrFiles (iPol 1)
T3 = arrFiles (iQuery 2)
T4 = arrFiles (iPol 3)
T5 = arrFiles (iQuery 4)
ArrFiles (iGrain0) = arrFiles (jpence0)
ArrFiles (iGrain1) = arrFiles (jpence1)
ArrFiles (iMagne2) = arrFiles (jPower2)
ArrFiles (iMagne3) = arrFiles (jpence3)
ArrFiles (iPol 4) = arrFiles (jBI 4)
ArrFiles (jPower0) = T1
ArrFiles (jPower1) = T2
ArrFiles (jPower2) = T3
ArrFiles (jp3) = T4
ArrFiles (jpen 4) = T5
End if
End Select
Next
Next
'generate a list
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + ("name")
SListFile = sListFile + ("")
SListFile = sListFile + ("Media")
SListFile = sListFile + ("")
SListFile = sListFile + ("size")
SListFile = sListFile + ("")
SListFile = sListFile + ("type")
SListFile = sListFile + ("")
SListFile = sListFile + ("update time")
SListFile = sListFile + ("")
Dim iLoopStart,iLoofEnd,iLoopStep
If intOrder = 0 then
ILoopStart = 0
ILoofEnd = fcount-1
ILoopStep = 1
Else
ILoopStart = fcount-1
ILoofEnd = 0
ILoopStep =-1
End if
Dim iCount,sTDStyleClass
ICount = 1
For j=iLoopStart to iLoofEnd Step iLoopStep
If instr (strFiletype,arrFiles (jPower1)) > 0 and iCount1024*1024 then
SListFile = sListFile + cstr (round (arrFiles (jMagine 2) / 1024 take 1024))
SListFile = sListFile + ("MB")
Else
SListFile = sListFile + cstr (round (arrFiles (jMagine 2) / 1024))
SListFile = sListFile + ("KB")
End if
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + cstr (arrFiles (jmem3))
SListFile = sListFile + ("")
SListFile = sListFile + ("")
SListFile = sListFile + (Cndate2 (arrFiles (jpene 4), 4))
SListFile = sListFile + ("")
SListFile = sListFile + ("")
ICount = iCount+1
End if
Next
SListFile = sListFile + ""
ListFile = sListFile
End Function
'generate the procedure for calling the file
Sub ShowFileListContent ()
Dim tUpdatetime,sUpdateContent
Dim fso,f,f_js,f_js_write
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.GetFolder (sShowPath)
Set f_js = fso.GetFile ("list.js")
'compare the last modification time between the calling file and the folder
If f.DateLastModifiedf_js.DateLastModified then
SUpdateContent = ListFile (sListFileType,iOrderFieldFileDate,iOrderDesc,iShowCount)
Set f_js_write = fso.CreateTextFile ("list.js", True)
'The JS call adds the following pair of [xss_clean]
'f_js_write.Write ("[xss_clean] ('")
F_js_write.Write (sUpdateContent)
'f_js_write.Write ("')")
F_js_write.Close
End If
End Sub
Call ShowFileListContent ()
The above is all the contents of the article "how to use scheduled tasks and VBS scripts to automatically WEB files in a folder". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.