#include <IE.au3>
#include <Array.au3>
#include <String.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#cs
#CE
$line_1='<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>CNTL提取自威海市气象局</TITLE>' & @CRLF & '<META http-equiv=Content-Type content="text/html; charset=gb2312">' &@CRLF& '<BODY class=nomarl_page>' &@CRLF
;$oIE = _IECreate ("http://www.vipshop.com/detail-46289-360-0.html", 0, 0,1,0)
TrayTip("CNTL程序开始","正在提取威海气象局发布的信息",30,1)
$oIE = _IECreate ("http://www.whqxj.com/", 0,0,1,0)
;MsgBox(0,"",$html_TXT)
$html=_IEDocReadHTML($oIE)
;$html_TXT=_IEBodyReadText ($oIE)
;$file_ok = FileOpen("威海气象台信息.txt", 10)
;FileWriteLine($file_ok, $html_TXT& @CRLF)
;FileClose($file_ok)
;Local $aArray1_TXT = _StringBetween($html_TXT, '石岛'&@CRLF, @CRLF&@CRLF&@CRLF&'成山头'&@CRLF)
;$html_shidao=_ArrayToString($aArray1_TXT)
;$html_shidao=StringStripWS($html_shidao, 8)
Local $aArray1 = _StringBetween($html, '<DIV id=石岛>', '</TR></TBODY></TABLE></TD></TR>')
Local $aArray2 = _StringBetween($html, '<DIV id=yubao_title>威海市气象台', '发布')
;_ArrayDisplay($aArray1, 'Default Search')
$html=_ArrayToString($aArray1)
$html=StringReplace($html, "/images/slide_top_bg.gif", "http://www.whqxj.com/images/slide_top_bg.gif")
$htm2=_ArrayToString($aArray2)
$htm2='<DIV id=yubao_title>威海气象台'& $htm2 & '发布</DIV>'
$html=$line_1 & '<DIV id=石岛>'& $html& @CRLF&'<IMG src="http://www.whqxj.com/images/slide_buttom.gif"></TBODY></TABLE></TD></TR>' &@CRLF& $htm2& '</BODY></HTML>'
Local $aArray1_trip = _StringBetween($html, '<TD align=middle width=93 height=16>','</TD>')
;_ArrayDisplay($aArray1_trip, 'Default Search')
$24hour=$aArray1_trip[0] & ":"&$aArray1_trip[3] &" "& $aArray1_trip[6] &" "& $aArray1_trip[9] & @CRLF
;MsgBox(0,"",$24hour)
$48hour=$aArray1_trip[1] & ":"&$aArray1_trip[4] &" "& $aArray1_trip[7] &" "& $aArray1_trip[10] & @CRLF
$72hour=$aArray1_trip[2] & ":"&$aArray1_trip[5] &" "& $aArray1_trip[8] &" "& $aArray1_trip[11]
$hour= StringMid($24hour,1) & StringMid($48hour,1) & StringMid($72hour,1)
Local $aArray1_trip2 = _StringBetween($html, '<DIV id=yubao_title>','</DIV>')
$hour= "石岛气象信息:"& @CRLF&$hour
TrayTip( _ArrayToString($aArray1_trip2) ,$hour,30,1)
;TrayTip("数组提取石岛气象信息",$hour,30,1)
;sleep(4000)
$i=0
$file_ok = FileOpen("威海气象台信息.htm", 10)
; 检查打开的文件是否可写
If $file_ok = -1 Then
MsgBox(16, "错误", "不能写入文件”唯品历史记录.txt“。")
Exit
EndIf
FileWriteLine($file_ok, $html& @CRLF)
;FileWriteLine($file_ok, "【"& _Now() & "】"& "程序运行结束" & @CRLF)
;FileWriteLine($file_ok, "*********************************************************")
FileClose($file_ok)
;Run("Notepad.exe 威海气象台信息.htm", "", @SW_MAXIMIZE)
;Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE 威海气象台信息.htm", "", @SW_MAXIMIZE)
;Run("威海气象台信息.htm")
;Run("Notepad.exe", @ScriptDir & "/威海气象台信息.htm", @SW_MAXIMIZE)
$Form = GUICreate("威海气象局石岛天气情况", 330, 343, -1, -1)
$oIE1 = _IECreateEmbedded ()
GUICtrlCreateObj($oIE1,0, 0, 330, 340)
GUISetState(@SW_SHOW)
_Go()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Go();加载网页
_IENavigate ($oIE1, @ScriptDir & "/威海气象台信息.htm")
EndFunc
Exit