#include <Inet.au3>
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>
#region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form1_1 = GUICreate("白银价格监控", 626, 410, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $max = GUICtrlCreateInput("", 368, 320, 105, 21)
Global $min = GUICtrlCreateInput("", 368, 360, 105, 21)
$Button1 = GUICtrlCreateButton("确 定", 496, 328, 105, 50)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0x434E54)
GUISetOnEvent($Button1,"_confirm")
$Label1 = GUICtrlCreateLabel("人民币买入价", 40, 320, 76, 17)
$Label2 = GUICtrlCreateLabel("美元的买入价", 40, 360, 76, 17)
$Label3 = GUICtrlCreateLabel("", 128, 320, 76, 17)
$Label4 = GUICtrlCreateLabel("", 128, 360, 76, 17)
$Label5 = GUICtrlCreateLabel("超过这个价格告诉我", 248, 320, 112, 17)
$Label6 = GUICtrlCreateLabel("低于这个价也告诉我", 248, 360, 112, 17)
Global $oie = _IECreateEmbedded()
GUICtrlCreateObj($oie, 0, 0, 620, 305)
_Timer_SetTimer($Form1_1, 25000, "_update")
Global $autocheck = 0
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
_IENavigate($oie, 'http://www.kitco.cn/cn/live_charts/silvercny.gif')
Global $s = _INetGetSource('http://gold.hexun.com/byxh/','True')
Sleep(3000)
Global $ss=StringRegExp($s,'(?i)<td[^>]*r">([^</td>]*)</td>',3)
Global $nowvalue = $ss[0]
GUICtrlSetData($Label3, $nowvalue)
GUICtrlSetData($Label4,$ss[2])
Global $minvalue
Global $maxvalue
While 1
Sleep(600000)
MsgBox(0,"","slll")
_update()
WEnd
Func _confirm()
If GUICtrlRead($max) > GUICtrlRead($min) And GUICtrlRead($min) > 0 Then
$minvalue = GUICtrlRead($min)
$maxvalue = GUICtrlRead($max)
$autocheck = 1
MsgBox(4096,"OK","搞定")
Else
MsgBox(4096,"error","something is wrong")
EndIf
EndFunc ;==>_confirm
;;;建行白银网址 http://price.zhjtong.com/1_ccb_silver_740_500.png?rnd=0.8697611133102328
;(?i)<td[^>]*r">([^</td>]*)</td>
;$s = FileRead(@ScriptDir &"\hh.htm")
Func _update()
_IEAction($oie, "refresh")
$s = _INetGetSource('http://gold.hexun.com/byxh/', 'True')
Sleep(3000)
$ss = StringRegExp($s, '(?i)<td[^>]*r">([^</td>]*)</td>', 3)
$nowvalue = $ss[0]
If $autocheck = 1 Then
If $nowvalue > $maxvalue Or $nowvalue < $minvalue Then
MsgBox(4096, "该动手了", $nowvalue)
EndIf
EndIf
EndFunc ;==>_update
Func _exit()
Exit
EndFunc