CODE: [Copy to clipboard]
<html><title>HTA template</title><head>
<HTA:APPLICATION
APPLICATIONNAME="HTA Template"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<style>
BODY
{
background-color: buttonface;
Font: arial,sans-serif
margin-top: 0px;`
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.button
{
width: 91px;
height: 25px;
font-family: arial,sans-serif;
font-size: 8pt;
}
td
{
font-family: arial,sans-serif;
font-size: 10pt;
}
#scroll
{
height:100%;
overflow:auto;
}
SELECT.FixedWidth
{
width: 17em; /* maybe use px for pixels or pt for points here */
}
</style>
<script language="VBScript">
Public fso
Dim iTimerID
Set fso=CreateObject("Scripting.FileSystemObject")
Sub ButtonClick
curPath=Mid(fso.GetParentFolderName(window.location),9)
seek curpath
End Sub
Sub seek(Path)
'Set fso=CreateObject("Scripting.FileSystemObject")
Set curF=fso.GetFolder(path)
If curF.SubFolders.count>0 Then
For Each subf In curF.SubFolders
seek subf
Next
End If
If curF.Files.count>0 Then
For Each file In curF.Files
scaning.innertext=file
iTimerID = window.setInterval("DF(file)",1000)
Next
End If
End Sub
Sub DF(files)
window.clearInterval(iTimerID)
If lcase(fso.GetExtensionName(files))="bak" Then
MsgBox files
done.innertext=done.innertext&vbCr&files
fso.DeleteFile files
End If
End Sub
Sub window_onload
window.resizeTo 700,400
End Sub
</script>
<body >
<p> 点击"查杀"按钮进行查杀:
<input class="button" type=BUTTON value="查杀" name="btnTestButton" onClick="ButtonClick">
</p>
<p> 当前正在查杀:<br>
<font color="#00FF00"><span id="scaning" class="FixedWidth" >请点击“查杀”按钮 </span>
</p>
</font></p>
<p> 被删除的文件:<br> </p> <font color="#00FF00"> <span id="done" class="FixedWidth" > </span></font>
</p>
<p> </p>
<P align="right">
</body></html>
CODE: [Copy to clipboard]
<html><title>HTA template</title><head>
<HTA:APPLICATION
APPLICATIONNAME="HTA Template"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<style>
BODY
{
background-color: buttonface;
Font: arial,sans-serif
margin-top: 0px;`
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.button
{
width: 91px;
height: 25px;
font-family: arial,sans-serif;
font-size: 8pt;
}
td
{
font-family: arial,sans-serif;
font-size: 10pt;
}
#scroll
{
height:100%;
overflow:scroll;
}
SELECT.FixedWidth
{
width: 17em; /* maybe use px for pixels or pt for points here */
}
</style>
<script language="VBScript">
Public fso
Dim iTimerID
Set fso=CreateObject("Scripting.FileSystemObject")
Sub ButtonClick
curPath=Replace(Mid(fso.GetParentFolderName(window.location),9),"%20"," ")
if document.getElementsByName("btnTestButton").item(0).value="查杀" then
iTimerID = window.setInterval("seek('" + curPath + "')",2000)
document.getElementsByName("btnTestButton").item(0).value="停止"
else
window.clearInterval(iTimerID)
document.getElementsByName("btnTestButton").item(0).value="查杀"
end if
End Sub
Sub seek(Path)
'Set fso=CreateObject("Scripting.FileSystemObject")
scaning.innertext=""
Set curF=fso.GetFolder(path)
If curF.SubFolders.count>0 Then
For Each subf In curF.SubFolders
seek subf
Next
End If
If curF.Files.count>0 Then
For Each file In curF.Files
scaning.innertext=scaning.innertext&vbCr&file
DF file
Next
End If
End Sub
Sub DF(files)
'window.clearInterval(iTimerID)
If lcase(fso.GetExtensionName(files))="bak" Then
MsgBox files
done.innertext=done.innertext&vbCr&files
fso.DeleteFile files
End If
End Sub
Sub window_onload
window.resizeTo 700,400
End Sub
</script>
<body >
<p> 点击"查杀"按钮进行查杀:
<input class="button" type=BUTTON value="查杀" name="btnTestButton" onClick="ButtonClick">
</p>
<p> 当前正在查杀:<br>
<font color="#000000"><span id="scaning" class="FixedWidth" >请点击“查杀”按钮 </span>
</p>
</font></p>
<p> 被删除的文件:<br> </p> <font color="#FF0000"> <span id="done" class="FixedWidth" > </span></font>
</p>
<p> </p>
<P align="right">
</body></html>
有个问题,路径的中的空格问题,会被转成有效的统一资源标识符,全部替换吧