﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1415	Issue with IE & HWnd($o_object.HWnd()) ERROR	Steveiwonder		"This is the error I'm getting it worked once... i tested it again (with no change to code) and got this this:

{{{
C:\Program Files\AutoIt3\Include\IE.au3 (3116) : ==> The requested action with this object has failed.:
Return HWnd($o_object.HWnd())
Return HWnd($o_object.HWnd()^ ERROR
>Exit code: 1    Time: 0.554
}}}


I did a search on the forum and came across this post.
[http://www.autoitscript.com/forum/index.php?showtopic=97549]

After the first guy saying ""A reboot"" fixed it i did the same and sure enough, it was fine. 

Although the conclution of the problem was suggested to be a windows error and no AutoIt - I was wondering IF is it auto it causing the problem in the first place?

I am sorry if i'm wrong just though i would point it out incase its a bug that you would like to fix.

Again it may just be a Windows issue.

I'm using:

IE8 (All Updates installed)
Windows XP Pro SP3.

Thanks for your time.

HERE IS MY SCRIPT:


{{{
#include <IE.au3>

Local $WinTitle = ""Case Untitled -""
Local $WinHandle
Local $oIE
Local $StringToFind = ""<TEXTAREA""
Local $CasePage = False
Local $i = 0
#cs
Questions for new ticket
#ce
Local $Q
Local $Questions[7]
$Questions[0] = ""When did issue start?""
$Questions[1] = ""Downtime available?""
$Questions[2] = ""Site Access?""
$Questions[3] = ""On Site Contact?""
$Questions[4] = ""Has equitment been checked/rebooted?""
$Questions[5] = ""VLAN/VC (Ethersphere Only)?""
$Questions[6] = ""How many errors? or how many times has circuit dropped (If Applicable)?""

#cs
End of Questions
#ce

While 1 = 1
	
	ConsoleWrite(""Waiting for new window"" & @CRLF)
	WaitforWindow()
	Questions()
	WinWaitClose($WinTitle)
	ConsoleWrite(""Window Closed"" & @CRLF)
Wend


	


Func Questions()
	sleep(1000)
	WinActivate($WinTitle)
	WinWaitActive($WinTitle)
	BlockInput(1)
	
	Opt(""MouseCoordMode"", 0)
	
	MouseClickDrag(""Left"", ""220"", ""165"", ""137"", ""165"", ""0"")
	Send(""{CTRLDOWN}c{CTRLUP}"")
	MouseClick(""Left"", ""235"", ""250"", ""1"", ""0"")
	Send(""{CTRLDOWN}v{CTRLUP}"")
	
	For $Question in $Questions
		$Q = $Q & $Question & @CRLF
	Next
	
	MouseClick(""Left"", ""537"", ""195"", ""1"", ""0"")
	sleep(100)
	MouseClick(""Left"", ""565"", ""343"", ""1"", ""0"")
	sleep(100)
	MouseClick(""Left"", ""694"", ""160"", ""1"", ""0"")	
	sleep(100)
	MouseClick(""Left"", ""100"", ""620"", ""1"", ""0"")
	Opt(""MouseCoordMode"", 1)
	
	ClipPut($Q)
	Send(""{CTRLDOWN}v{CTRLUP}"")
	BlockInput(0)
EndFunc


Func WaitforWindow()	
	WinWait($WinTitle)
	ConsoleWrite(""Wait Finished! Window Showed up!"" & @CRLF)
	If WinExists($WinTitle) Then
		$WinHandle = WinGetHandle($WinTitle)
		$oIE = _IEAttach($WinHandle, ""HWND"")

		ConsoleWrite(""Winhandle Found, Attach Complete"" & @CRLF)
		While $CasePage = False
			If WinExists(""Case Untitled:Flash! -"") Then 
				WinSetState(""Case Untitled:Flash! -"","""",@SW_MINIMIZE)
			EndIf
			
			If WinExists($WinTitle) Then	;FailSafe - If Someoene closes the window while it is continuously reading the HTML then it will exit.		
			
				_IELoadWait($oIE); Wait for Load
				ConsoleWrite(""Load Complete"" & @CRLF)
				$html = _IEBodyReadHTML($oIE) ; Read HTML

				If StringInStr($html, $StringToFind) Then ; HTML contains the correct string? The right page is now visible!
					$CasePage = True
					ConsoleWrite(""New Case Window Open!"" & @CRLF)
					Return 1
				EndIf
				
			Else
				Return 0 ; Window was closed before it found the HTML inside the corrrect window.
			EndIf
			
		sleep(15000)
		WEnd
	EndIf	
EndFunc

}}}
"	Bug	closed		AutoIt	3.3.2.0	None	No Bug		
