Sign in to follow this  
Followers 0
shreeks

How to Maximize the IE window without using HWND.

5 posts in this topic

I need to know how to maximize the IE window without using HWND.

this is my code.

#include <IE.au3>

$ie = ObjCreate("InternetExplorer.Application")

$ie.visible = true

$ie.navigate("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")

;ShellExecute("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")

$HWND = _IEPropertyGet($ie, "hwnd") ; Window handling command

WinSetState($HWND, "", @SW_MAXIMIZE) ; Maximize the IE window

This code throgh an error "Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd()))

Return SetError($_IEStatus_Success, 0, HWnd($o_object.HWnd()^ ERROR"

Let me know how to resolve this issue.

Thanks.


Learning is Lifelong!

Share this post


Link to post
Share on other sites



It's strange, it works for me...


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

It's strange, it works for me...

This is my code.Still am getting error.please clarify on this.

#include <IE.au3>

$ie = ObjCreate("InternetExplorer.Application")

$ie.visible = true

$ie.navigate("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")

$HWND = _IEPropertyGet($ie, "hwnd") ; Window handling command

WinSetState($HWND, "", @SW_MAXIMIZE) ; Maximize the IE window

;sleep(2000)

;MsgBox(0,"","t1")

WinWaitActive('One Cognizant')

$iPos = WinGetPos('One Cognizant')

;sleep(2000)

$iPos = PixelSearch($iPos[0], $iPos[1], $iPos[2] + $iPos[0], $iPos[3] + $iPos[1],0x86A7BF, 1) ;0x947B91

sleep(1000)

If Not @error Then

MouseMove($iPos[0], $iPos[1])

MouseClick("left")

else

MsgBox(0,"","error")

EndIf

Attached the snapshot of the error screen.

Thanks.

post-64194-0-53595000-1306924406_thumb.p


Learning is Lifelong!

Share this post


Link to post
Share on other sites

What's your IE Version ?

#include <Array.au3>
#include <IE.au3>

$ie = ObjCreate("InternetExplorer.Application")
$ie.visible = true
$ie.navigate("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")
$HWND = _IEPropertyGet($ie, "hwnd") ; Window handling command
WinSetState ( $HWND, "", @SW_MAXIMIZE ) ; Maximize the IE window
Do
    Sleep ( 100 )
Until _IsMaximized ( $HWND )
$_WinWaitActive = WinWaitActive ( $HWND, '' )
$_WinPos = WinGetPos ( $HWND, '' );_ArrayDisplay ( $_WinPos )
$iPos = PixelSearch ( $_WinPos[0], $_WinPos[1], $_WinPos[2], $_WinPos[3], 0x86A7BF, 1 ) ;0x947B91
If Not @error Then
    _ArrayDisplay ( $iPos )
    MouseMove($iPos[0], $iPos[1])
    MouseClick("left")
Else
    MsgBox(0,"","error")
EndIf

Func _IsMaximized ( $_Hwnd )
    If BitAnd ( WinGetState ( $_Hwnd ), 32 ) Then Return 1
EndFunc ;==> _IsMaximized ( )

This script works with IE7...Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Try replacing these lines:

$ie = ObjCreate("InternetExplorer.Application")

$ie.visible = true

$ie.navigate("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")

with this:

$ie = _IECreate("http://ctsintcospsbo1:8080/AIC/HTML/AmIcognizant.html")

which will insure the document has loaded before moving on.

dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0