IE表单操作(或后台POST)(多框架镶嵌)
本帖最后由 破帽遮颜 于 2009-12-10 19:53 编辑#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 楼主是不是在写聊天软件? 估计在某一天楼主会把这软件拿去赚钱,用于商业用途。 楼上的,我是否用于商业与这悬赏有关联?另外规定商业用途的软件就不可以提问?
:face (13): 没能力,飘过~~~ :face (28): 不能分享出来吗? 能分享源码嘛:face (37): {:3_88:}回复 4# 破帽遮颜
猜测而已,楼主莫见怪 看的一头雾水。。。 本帖最后由 lifuxing8 于 2009-12-23 22:55 编辑
是不是获取不到框架内容对象?
一句代码就可以搞定:$ouserName=$oIE.document.frames.speak.username.value
把分给我吧,呵呵
不明白问我,qq:11093025,绝对能给你搞定 完全不知道楼主在坐山么!
页:
[1]