Jump to content
Sign in to follow this  
JohnOne

ControlGetPos()

Recommended Posts

JohnOne

Can someone check that controlgetpos() returns the correct position of the browser

area of Internet explorer?

I'm using IE 8 and for me it returns incorrect Y pos

It return 67 for me, when the actual mouse Y pos is 89 (Maximized)

Opt("WinTitleMatchMode",2)

$wind = "Windows Internet Explorer"
$Class = "[CLASS:Internet Explorer_Server; INSTANCE:1]"

WinActivate($wind)

$pos = ControlGetPos($wind,"",$Class)

If IsArray($pos) Then
ConsoleWrite($pos[0] & @LF & $pos[1] & @LF & $pos[2] & @LF & $pos[3] & @LF )

MouseMove($pos[0],$pos[1])
EndIf

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
ileandros

Returns 93 for me and the actual Y position in 93. So it returns correct.

Maybe a toolbar or something is affecting it for you


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
JohnOne

What IE version are you using?

EDIT:

There are no toolbars, that script moves the mouse half way up the IE favourites button for me.

Works fine on all other windows I've tried, including chrome with and without toolbars.

Just seems to be IE, it's cracking me up a bit.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
ileandros

Im using 8.

It doesnt move on favorite button for me. Just a random mousemove on the screen.

But thats normal depends on the display setting u have on ur browser.

Even though if u want to click on a button use some coords on ur mouse or do an IE click why bothering like this


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
JohnOne

It's not random,your mouse should move to x,y co-ordinates 0,98 for you

which should be the top left of actual browser area of IE.

If I want to draw something on a control I need to know where that control is

and It's just not finding it for me.

If you change ControlgetPos to WingetPos() (obviously remove $Class) what do you get

for IE xy, I get -8,-8 which is also weird because I'd expect 0,0.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
JohnOne

What seems to be going on here is, the window is located at Y pos -8

and it seems to be the client area of the window being returned rather than the control position.

Doing my head in, anyone else see this behaviour?

EDIT:

Here is another issue, I have noticed while trying to solve this.

Window is maximized

WinMove($wind,"",0,0) ; does not work, window is not moved (unexpected)
WinMove($wind,"",-1,-1) ; Moves window to 7,7 (unexpected)
WinMove($wind,"",1,1) ; Moves window to 1,1 (expected)
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
JohnOne

Shameless Bump.

I just want to find out if it is only me who gets these results, I know the other poster said no.

All you have to do is have an IE window open, and window info tool unfrozen , run script, and tell me the

control info from the window info tool.

Opt("WinTitleMatchMode", 2)
Local $aCPos = _IEBrowserControlXY()
MouseMove($aCPos[0], $aCPos[1])
WinActivate("AutoIt v3 Window Info")
Sleep(200)
Send("^!f")


Func _IEBrowserControlXY()
Local $aXY[2] = [0, 0]
Local $Wind = "Windows Internet Explorer"
Local $Class = "[CLASS:Internet Explorer_Server; INSTANCE:1]"
Local $Winpos = WinGetPos($Wind)
Local $pos = ControlGetPos($Wind, "", $Class)

WinActivate($Wind)

If IsArray($pos) Then
$aXY[0] = $Winpos[0] + $pos[0]
$aXY[1] = $Winpos[1] + $pos[1]
EndIf

Return $aXY
EndFunc   ;==>_IEBrowserControlXY
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
water

I run Windows 7 64 Bit and IE 9. The Window Info Tool, Control Tab doesn't show any data.

Here is a screenshot of the mouse position.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ileandros

>>>> Window <<<<
Title: ControlGetPos() - General Help and Support - AutoIt Forums - Windows Internet Explorer
Class: IEFrame
Position: -8, -8
Size: 1456, 886
Style: 0x17CF0000
ExStyle: 0x00000100
Handle: 0x0003002C
>>>> Control <<<<
Class: Internet Explorer_Server
Instance: 1
ClassnameNN: Internet Explorer_Server1
Name:
Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]
ID:
Text:
Position: 0, 93
Size: 1440, 785
ControlClick Coords: 0, 1
Style: 0x56000000
ExStyle: 0x00000000
Handle: 0x0001020A
>>>> Mouse <<<<
Position: 0, 86
Cursor ID: 2
Color: 0xD8DDE8
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
Navigation Bar
[url="http://www.autoitscript.com/forum/topic/144892-controlgetpos/"]http://www.autoitscript.com/forum/topic/144892-controlgetpos/[/url]
Address Combo Control
Page Control
Favorites and Tools Bar
LinksBand
Favorites Bar
Add to Favorites bar
ControlGetPos() - General Help and Support - AutoIt Forums - Windows Internet Explorer

>>>> Hidden Text <<<<

Edited by ileandros

I feel nothing.It feels great.

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  

×