Jump to content

ControlClick with coordinates


Nergock
 Share

Recommended Posts

I've successfully used ControlClick with coordinates in the past but for some reason I cannot get it to work for this control. I am currently using v3.2.12.1. My code is as follows:

ControlClick("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "WindowsForms10.SysTreeView32.app.0.202c6661", "left", 1, 84,40)

Attached is an image of what I am expecting to see with the ControlClick. Instead, what I get is the tree menu option being selected but the options are not expanded. Any help would greatly be appreciated.

I've tried using ControlFocus but that didn't help. The result return from the ControlClick is 1.

post-45051-1232143758_thumb.jpg

post-45051-1232143843_thumb.jpg

Edited by Nergock
Link to comment
Share on other sites

FireFox, thank you for the prompt response. I cannot use the Send function because I don't know what to send to get the treeview menu option to expand. Not sure if this is what you are asking for by "au3info".

>>>> Window <<<<

Title: Integration Manager for Microsoft Dynamics GP 10.0

Class: WindowsForms10.window.8.app.0.202c666

Position: 362, 239

Size: 716, 394

Style: 0x16C80000

ExStyle: 0x00010101

Handle: 0x0014028A

>>>> Control <<<<

Class: WindowsForms10.SysTreeView32.app.0.202c666

Instance: 1

ClassnameNN: WindowsForms10.SysTreeView32.app.0.202c6661

Advanced (Class): [CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]

ID: 131724

Text:

Position: 35, 91

Size: 416, 150

ControlClick Coords: 258, 61

Style: 0x56010007

ExStyle: 0x00000200

Handle: 0x0002028C

>>>> Mouse <<<<

Position: 293, 152

Cursor ID: 2

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Location:

Integrates data into Dynamics GP using adapters built on eConnect.

B&rowse

C:\Program Files\Microsoft Dynamics\Integration Manager 10

Cancel

&Next >>

<< &Back

Select the features to install.

Select Features

>>>> Hidden Text <<<<

Edited by Nergock
Link to comment
Share on other sites

FireFox, I will give that a try on Tuesday and will report back the results. Thank you for your help. May I ask how you came up with the coordinates?

I do not think that those are coordinates.

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '', 131724, 1)

ControlClick('title...........................................................', 'text', controlID, button, clicks, x, y)

If you want to try what he posted, add the button...

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '', 131724, 'left', 1)

...or just leave all of that off and let the defaults take over:

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '', 131724)

I'm not saying that this will work - just pointing out the missing button parm in the posted code.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thank you for the suggestion. Unfortuantely the treeview menu option expansion does not respond to any keyboard keys...including the left arrow.

Bummer.

Does chapter 19 of this PDF help?

http://mbs.microsoft.com/downloads/public/...MUsersGuide.pdf

It happens to be for version 9 and your screen shots show v10

It came from here:

http://msdn.microsoft.com/en-us/dynamics/gp/bb419280.aspx

Sorry if that is a dead end...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I've successfully used ControlClick with coordinates in the past but for some reason I cannot get it to work for this control. I am currently using v3.2.12.1. My code is as follows:

ControlClick("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "WindowsForms10.SysTreeView32.app.0.202c6661", "left", 1, 84,40)

Attached is an image of what I am expecting to see with the ControlClick. Instead, what I get is the tree menu option being selected but the options are not expanded. Any help would greatly be appreciated.

I've tried using ControlFocus but that didn't help. The result return from the ControlClick is 1.

Try this: ControlClick("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "[CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]", "left", 1, 84,40)
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

@Manjish

Try this: ControlClick("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "[CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]", "left", 1, 84,40)

Not sure it would work with text :)

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '','[CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]', 'left', 1, 84,40)

Cheers, FireFox.

Link to comment
Share on other sites

@Manjish

Not sure it would work with text :)

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '','[CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]', 'left', 1, 84,40)

Cheers, FireFox.

Yup you are right. Usually i never use any text and use "" in the text field. I forgot to remove that part when i copy pasted it.

Neways thanks for the correction. I think it shud work now. Lets see.

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

FireFox's suggestion did not work. Result return is 0.

ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '', 131724, 'left', 1)

Manjish's suggestion yield the same result as what I originally posted. It just selected the menu option but did not expand it. Excluding the text also produce the same result.

ControlClick("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "[CLASS:WindowsForms10.SysTreeView32.app.0.202c666; INSTANCE:1]", "left", 1, 84,40)

Got it to work using MouseClick but the coordinates for the MouseClick is affected by different screen resolutions (whereas ControlClick is not).

MouseClick("primary", 482, 392)

Tried the UDF function suggested in this post but still no luck: http://www.autoitscript.com/forum/index.ph...l=SysTreeView32

All it did was select the node but did not expand the node menu option.

$hTreeView = ControlGetHandle("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "WindowsForms10.SysTreeView32.app.0.202c6661")

Navigate($hTreeView, "eConnect Destination Adapters")

Func Navigate($Handle, $Control)

$hItemFound = _GUICtrlTreeView_FindItem($Handle, $Control)

If $hItemFound Then

_GUICtrlTreeView_Expand($Handle, $hItemFound, True)

Sleep(1000)

_GUICtrlTreeView_SelectItem($Handle, $hItemFound, True)

Sleep(1000)

_GUICtrlTreeView_ClickItem($Handle, $hItemFound, "left", False, 1)

Else

msgbox(0, 'Error', 'Cannot Find ' & $Control)

EndIf

EndFunc

Edited by Nergock
Link to comment
Share on other sites

Got it to work using the code below but I had to modify the method "_GUICtrlTreeView_ClickItem" in <GuiTreeView2.au3> to take an additional parameter. If the additional parameter is True, then additional logic is added to calculate the X coordinate so that it will click on the "image" to the left of the menu item instead of clicking on the menu item. This works with different screen resoltuions. Thanks for the input from everyone.

$hTreeView = ControlGetHandle("Integration Manager for Microsoft Dynamics GP 10.0", "Select the features to install", "WindowsForms10.SysTreeView32.app.0.202c6661")

$hTreeItem = _GUICtrlTreeView_FindItem($hTreeView, "eConnect Destination Adapters")

_GUICtrlTreeView_ClickItem($hTreeView, $hTreeItem, "left", True, 1, 0, True)

Func _GUICtrlTreeView_ClickItem($hWnd, $hItem, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 0, $fClickImage = False)

If $Debug_TV Then _GUICtrlTreeView_ValidateClassName($hWnd)

If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

Local $tPoint, $tRect, $iX, $iY, $iMode, $aPos

$tRect = _GUICtrlTreeView_DisplayRectEx($hWnd, $hItem, True)

;$tPoint = _WinAPI_PointFromRect($tRect)

If ($fClickImage == False) Then

$tPoint = _WinAPI_PointFromRect($tRect, True) ;center of menu item

Else

$tPoint = _WinAPI_PointFromRect($tRect, False) ;top-left of menu item

EndIf

_WinAPI_ClientToScreen($hWnd, $tPoint)

_WinAPI_GetXYFromPoint($tPoint, $iX, $iY)

If ($fClickImage == True) Then

$iX = $iX - 10 ; move left 10 pixel to locate the image of the menu item

EndIf

If Not $fMove Then

$iMode = Opt("MouseCoordMode", 1)

$aPos = MouseGetPos()

Opt("MouseCoordMode", $iMode)

_WinAPI_ShowCursor(False)

MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)

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

_WinAPI_ShowCursor(True)

Else

MsgBox(0, "test", $iX & ", " & $iY)

MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)

EndIf

EndFunc ;==>_GUICtrlTreeView_ClickItem

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...