网络记录器,一个自动搜索指定地址并保存的程序

网络记录器,一个自动搜索指定地址并保存的程序
2010年03月05日
  '一个老程序,希望对你有用
  '依赖文件:
  'D:\UrlList.txt"
  Const ForReading = 1, ForWriting = 2, ForAppending = 8
  Dim fso, fin,fout
  Dim WshShell
  dim ThisLline
  Dim Poscomma
  set WshShell=WScript.CreateObject("WScript.Shell")
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set fin=fso.opentextfile("D:\webstock\UrlList.txt",forreading,0)
  while fin.AtEndOfStream True
  ThisLine=fin.readline
  Poscomma=instr(ThisLine,",")
  call OpenAUrlAndSaveSource(mid(ThisLine,1,PosComma-1),mid(ThisLine,PosComma+1) & FormatToday() & ".html")
  wend
  fin.close
  set fin=nothing
  set fso=nothing
  set WshShell=nothing
  Wscript.Quit
  'Call Example : call OpenAUrlAndSaveSource("http://www.test.com","d:\" & FormatToday() & ".html")
  'Parmeter
  'Navigate
  'FullScreen
  'AddressBar
  'MenuBar
  'ToolBAr
  Sub OpenAUrlAndSaveSource(ThisUrl,SavedFileName)
  set WshShell = WScript.CreateObject("WScript.Shell")
  On Error resume next
  Set objIE1=CreateObject("InternetExplorer.application")
  objIE1.Visible=true
  objIE1.NAvigate ThisUrl
  objIE1.FullScreen true
  WScript.Sleep 5000
  WshShell.SendKeys "%V"
  WScript.Sleep 2000
  WshShell.SendKeys "C"
  WScript.Sleep 2000
  'Save notepad
  WshShell.SendKeys "%F"
  WScript.Sleep 2000
  WshShell.SendKeys "A"
  WScript.Sleep 2000
  WshShell.SendKeys SavedFileName
  WScript.Sleep 2000
  WshShell.SendKeys "%S"
  WScript.Sleep 2000
  'Close Notepad
  WshShell.SendKeys "%F"
  WScript.Sleep 2000
  WshShell.SendKeys "X"
  WScript.Sleep 5000
  objIE1.quit
  end sub
  Function FormatToday()
  strYear = DatePart("yyyy",Date)
  ' Get current month, add leading zero if necessary
  If DatePart("m",Date) < 10 Then
  strMonth = 0 & DatePart("m",Date)
  Else
  strMonth = DatePart("m",Date)
  End If
  ' Get current day, add leading zero if necessary
  If DatePart("d",Date) < 10 Then
  strDay = 0 & DatePart("d",Date)
  Else
  strDay = DatePart("d",Date)
  End If
  ' Format output for today
  FormatToday = strYear & strMonth & strDay
  end function
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值