#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=c:\source\gui\acfun文章获取.kxf
$Form1_1 = GUICreate("ACFUN文章获取器", 637, 456, 192, 124)
$Label1 = GUICtrlCreateLabel("URL地址:", 40, 16, 100, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Input1 = GUICtrlCreateInput("", 144, 16, 425, 21)
$Edit1 = GUICtrlCreateEdit("", 40, 104, 529, 281)
;GUICtrlSetData(-1, "")
GUICtrlSetData($Edit1, "")
$Button1 = GUICtrlCreateButton("抓取", 56, 400, 75, 25)
$Button2 = GUICtrlCreateButton("复制标题", 448, 400, 75, 25)
$Button3 = GUICtrlCreateButton("复制内容", 192, 400, 75, 25)
$Button4 = GUICtrlCreateButton("清空", 320, 400, 75, 25)
$Label2 = GUICtrlCreateLabel("文章标题:", 40, 56, 100, 33)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Input2 = GUICtrlCreateInput("", 144, 56, 425, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Url= GUICtrlRead($Input1)
Local $InetRead = InetRead($Url), $HTMLContents
If $InetRead <> "" Then $HTMLContents = BinaryToString($InetRead, 4)
$_Title = _StringBetween($HTMLContents, '<h2>', '</h2>')
$_Content= _StringBetween($HTMLContents, '<span class="clearfix"></span></div><div id="area-player"><p>', '<span class="clearfix"></span></div>')
GUICtrlSetData($Input2 , $_Title[0])
GUICtrlSetData($Edit1 , $_Content[0])
Case $Button2
$_Title = GUICtrlRead($Input2)
Case $Button3
$_Title = GUICtrlRead($Edit1)
Case $Button4
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
GUICtrlSetData($Edit1, "")
EndSwitch
WEnd
|