标题: VBS获取IE缓存中的音乐文件 [打印本页]
作者: Batcher 时间: 2009-2-27 22:23 标题: VBS获取IE缓存中的音乐文件
- On Error Resume Next
- Dim Fso,Filenum,Dirnum,sPath,TmpType,newFP
- IF MsgBox("请确定已经先打开浏览器,开始在线视听!",vbYesNo,"提示") = vbNo Then
- Wscript.Quit
- Else
- Set Fso = Wscript.CreateObject("Scripting.FileSystemobject")
- Set Wfolder=Fso.getspecialfolder(2)
- Filenum = 0
- Dirnum = 0
- sPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
- TmpPath = trim(CreateObject("Wscript.Shell").ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Temporary Internet Files\")
- FileType = LCase(Inputbox("wma、wav、flv、swf、mp3、mid、或其它类型","文件类型:","wma"))
- newFP=LCase(Inputbox("请输入文件存放路径:","存放路径","D:\TempFile"))
- if right(newFP,1) <> "\" then
- newFP = newFP & "\"
- end if
- if (fso.folderexists(newFP)) then
- FindFiles TmpPath
- else
- set foldr=fso.createfolder(newFP)
- FindFiles TmpPath
- end if
- end if
-
- if msgbox("文件提取完成!" & vbCrLf & vbCrLf & vbCrLf & "是否需要打开 " & newFP & vbcrlf,vbYesNo,"执行结果") = vbYes Then
- set cmd=createobject("wscript.shell")
- cmd.run newFP
- else
- wscript.quit
- end if
- Sub FindFiles(ByVal FPath)
- On Error Resume Next
- Dim fso, myFolder, myFile, curFolder
- Set fso = wscript.CreateObject("scripting.filesystemobject")
- Set curFolders = fso.getfolder(FPath)
- Dirnum = Dirnum + 1
- If curFolders.Files.Count > 0 Then
- For Each myFile In curFolders.Files
- If InStr(1, LCase(myFile.Name), FileType) > 0 Then
- filepath = FormatPath(FPath) & "\" & myFile.Name
- fso.deletefile(filepath)
- if fso.fileexists(filepath) then
- if msgbox("是否需要为被提取文件重命名?" , vbYesNo , "提示" ) = vbYes then
- fso.copyfile filepath,newFP & inputbox("请输入新文件名:","提示","NewFile") & "." & filetype,true
- else
- fso.copyfile filepath,newFP,true
- end if
- end if
- Filenum = Filenum + 1
- End If
- Next
- End If
- If curFolders.subfolders.Count > 0 Then
- For Each myFolder In curFolders.subfolders
- FindFiles FormatPath(FPath) & "\" & myFolder.Name
- Next
- End If
- End Sub
- Function FormatPath(ByVal FPath)
- FPath = Trim(FPath)
- FormatPath = FPath
- If Right(FPath, 1) = "\" Then FormatPath = Mid(FPath, 1, Len(FPath) - 1)
- End Function
复制代码
作者: defanive 时间: 2009-2-27 22:34
缓存中的东东,VBS可以直接用FSO操作的么,第一次知道。。。
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |