Nergock Posted January 16, 2009 Share Posted January 16, 2009 (edited) 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. Edited January 16, 2009 by Nergock Link to comment Share on other sites More sharing options...
FireFox Posted January 16, 2009 Share Posted January 16, 2009 (edited) @NergockEdit : Welcome to autoit forum ! Can you posts results of au3info ?-You can use mouse functions-You can use send functionCheers, FireFox. Edited January 16, 2009 by FireFox Link to comment Share on other sites More sharing options...
Nergock Posted January 16, 2009 Author Share Posted January 16, 2009 (edited) 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 January 16, 2009 by Nergock Link to comment Share on other sites More sharing options...
FireFox Posted January 17, 2009 Share Posted January 17, 2009 @Nergock ControlClick('Integration Manager for Microsoft Dynamics GP 10.0', '', 131724, 1) Cheers, FireFox. Link to comment Share on other sites More sharing options...
Nergock Posted January 17, 2009 Author Share Posted January 17, 2009 (edited) 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? Edited January 17, 2009 by Nergock Link to comment Share on other sites More sharing options...
herewasplato Posted January 17, 2009 Share Posted January 17, 2009 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 More sharing options...
herewasplato Posted January 17, 2009 Share Posted January 17, 2009 ... I don't know what to send to get the treeview menu option to expand. ...Manually try left arrow to expand and then down arrow... then try it in your script. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Nergock Posted January 18, 2009 Author Share Posted January 18, 2009 Thank you for the suggestion. Unfortuantely the treeview menu option expansion does not respond to any keyboard keys...including the left arrow. Link to comment Share on other sites More sharing options...
herewasplato Posted January 19, 2009 Share Posted January 19, 2009 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.pdfIt happens to be for version 9 and your screen shots show v10It came from here:http://msdn.microsoft.com/en-us/dynamics/gp/bb419280.aspxSorry if that is a dead end... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Manjish Posted January 19, 2009 Share Posted January 19, 2009 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 More sharing options...
FireFox Posted January 19, 2009 Share Posted January 19, 2009 @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 More sharing options...
Manjish Posted January 19, 2009 Share Posted January 19, 2009 @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 More sharing options...
Nergock Posted January 20, 2009 Author Share Posted January 20, 2009 (edited) 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=SysTreeView32All 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) EndIfEndFunc Edited January 20, 2009 by Nergock Link to comment Share on other sites More sharing options...
Nergock Posted January 20, 2009 Author Share Posted January 20, 2009 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) EndIfEndFunc ;==>_GUICtrlTreeView_ClickItem Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now