#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=C:\Users\Sxd\Desktop\webChat.kxf
$Form1 = GUICreate("WebChat", 624, 126, 215, 169)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Label1 = GUICtrlCreateLabel("网友", 8, 8, 28, 17)
$Input1 = GUICtrlCreateInput("", 40, 8, 121, 21)
$Label2 = GUICtrlCreateLabel("对", 176, 8, 16, 17)
$Input2 = GUICtrlCreateInput("", 200, 8, 121, 21)
$Label3 = GUICtrlCreateLabel("说:", 8, 40, 19, 17)
$Edit1 = GUICtrlCreateEdit("", 40, 40, 281, 65)
$Checkbox1 = GUICtrlCreateCheckbox("悄悄话", 336, 8, 57, 17)
$Button1 = GUICtrlCreateButton("Send", 336, 40, 75, 57, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Const $sWebChatURL = 'http://127.0.0.1:1055/chat.htm'
$oIE = _IECreate($sWebChatURL)
Sleep(5000)
$oMain = _IEFrameGetCollection($oIE, 0)
$oIFrame = _IEFrameGetObjByName($oMain, 'speak')
$oUserName = _IEGetObjByName($oIFrame, 'username')
$oSayTo = _IEGetObjByName($oIFrame, 'sayto')
$oStealth = _IEGetObjByName($oIFrame, 'stealth')
$oEditWord = _IEFrameGetObjByName($oIFrame, 'editword')
$oSpeak = _IEFormGetObjByName($oIFrame, 'speak')
While 1
Sleep(100)
WEnd
Func Button1Click()
;悄悄话
If GUICtrlRead($Checkbox1) = 1 Then
$oStealth.checked = True
Else
$oStealth.checked = False
EndIf
;网友
$oUserName.value = GUICtrlRead($Input1)
;对谁说
$oSayTo.value = GUICtrlRead($Input2)
;内容
$oEditWord.document.body.innertext = GUICtrlRead($Edit1)
;发送
_IEFormImageClick($oSpeak, 'send.gif')
EndFunc ;==>Button1Click
Func Form1Close()
Exit
EndFunc ;==>Form1Close