Board logo

标题: VBS获取IE缓存中的音乐文件 [打印本页]

作者: Batcher    时间: 2009-2-27 22:23     标题: VBS获取IE缓存中的音乐文件

  1. On Error Resume Next
  2. Dim Fso,Filenum,Dirnum,sPath,TmpType,newFP
  3. IF MsgBox("请确定已经先打开浏览器,开始在线视听!",vbYesNo,"提示") = vbNo Then
  4. Wscript.Quit
  5. Else
  6. Set Fso = Wscript.CreateObject("Scripting.FileSystemobject")
  7. Set Wfolder=Fso.getspecialfolder(2)
  8. Filenum = 0
  9. Dirnum = 0
  10. sPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
  11. TmpPath = trim(CreateObject("Wscript.Shell").ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Temporary Internet Files\")
  12. FileType = LCase(Inputbox("wma、wav、flv、swf、mp3、mid、或其它类型","文件类型:","wma"))
  13. newFP=LCase(Inputbox("请输入文件存放路径:","存放路径","D:\TempFile"))
  14. if right(newFP,1) <> "\" then
  15. newFP = newFP & "\"
  16. end if
  17. if (fso.folderexists(newFP)) then
  18. FindFiles TmpPath
  19. else
  20. set foldr=fso.createfolder(newFP)
  21. FindFiles TmpPath
  22. end if
  23. end if
  24. if msgbox("文件提取完成!" & vbCrLf & vbCrLf & vbCrLf & "是否需要打开 " & newFP & vbcrlf,vbYesNo,"执行结果") = vbYes Then
  25. set cmd=createobject("wscript.shell")
  26. cmd.run newFP
  27. else
  28. wscript.quit
  29. end if
  30. Sub FindFiles(ByVal FPath)
  31. On Error Resume Next
  32. Dim fso, myFolder, myFile, curFolder
  33. Set fso = wscript.CreateObject("scripting.filesystemobject")
  34. Set curFolders = fso.getfolder(FPath)
  35. Dirnum = Dirnum + 1
  36. If curFolders.Files.Count > 0 Then
  37. For Each myFile In curFolders.Files
  38. If InStr(1, LCase(myFile.Name), FileType) > 0 Then
  39. filepath = FormatPath(FPath) & "\" & myFile.Name
  40. fso.deletefile(filepath)
  41. if fso.fileexists(filepath) then
  42. if msgbox("是否需要为被提取文件重命名?" , vbYesNo , "提示" ) = vbYes then
  43. fso.copyfile filepath,newFP & inputbox("请输入新文件名:","提示","NewFile") & "." & filetype,true
  44. else
  45. fso.copyfile filepath,newFP,true
  46. end if
  47. end if
  48. Filenum = Filenum + 1
  49. End If
  50. Next
  51. End If
  52. If curFolders.subfolders.Count > 0 Then
  53. For Each myFolder In curFolders.subfolders
  54. FindFiles FormatPath(FPath) & "\" & myFolder.Name
  55. Next
  56. End If
  57. End Sub
  58. Function FormatPath(ByVal FPath)
  59. FPath = Trim(FPath)
  60. FormatPath = FPath
  61. If Right(FPath, 1) = "\" Then FormatPath = Mid(FPath, 1, Len(FPath) - 1)
  62. End Function
复制代码

作者: defanive    时间: 2009-2-27 22:34

缓存中的东东,VBS可以直接用FSO操作的么,第一次知道。。。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2