matb Posted April 19, 2008 Share Posted April 19, 2008 Hello all, I'm currently evaluating AutoIt as a means of automating some software tests. What I need to be able to do is to right-click a node in the tree-structure in the MMC 3.0 console. Let's use the "Computer Management" system tool under Control Panel->Administrative Tools for this example. I have found it to be very easy to expand and select nodes with AutoIt using code like this: AutoItSetOption ( "WinTitleMatchMode", 4) WinActivate ( "[REGEXPTITLE:Computer Management.*]") ControlTreeView ( "Computer Management", "", 12785, "Expand", "Computer Management (Local)|System Tools" ) ControlTreeView ( "Computer Management", "", 12785, "Expand", "Computer Management (Local)|System Tools|Event Viewer" ) ControlTreeView ( "Computer Management", "", 12785, "Expand", "Computer Management (Local)|System Tools|Event Viewer|Security" ) ControlTreeView ( "Computer Management", "", 12785, "Select", "Computer Management (Local)|System Tools|Event Viewer|Security" ) However, I have not found an easy way to right click on a node (like the Security node in this example). The following statement doesn't seem to work: ControlClick ( "Computer Management", "", 12785, "right") I've had no success adding x,y coordinates to the ControlClick method like this either: $windowHandle = WinGetHandle("[REGEXPTITLE:Computer Management.*]") $treeHandle = ControlGetHandle($windowHandle, "", "SysTreeView321") $securityHandle = _GUICtrlTreeView_FindItem($treeHandle, "Security", True, _GUICtrlTreeView_GetFirstItem($treeHandle)) $securityRect = _GUICtrlTreeView_DisplayRect($treeHandle, $securityHandle, True) $retVal = ControlClick ( "Computer Management", "", 12785, "right", 1, $securityRect[0]+5, $securityRect[1]+5) The only way I've been able to right click anywhere on the tree control is by calculating some x,y coordinates and moving the mouse there before right clicking. My question is this: Is there an easy way with AutoIt to right click on the node in the tree control without doing some ugly screen-coordinate calculations and movement of the mouse? Thanks in advance Link to comment Share on other sites More sharing options...
Siao Posted April 19, 2008 Share Posted April 19, 2008 If you are sure that your code works correctly and coordinates from _GUICtrlTreeView_DisplayRect are ok, try doing ControlFocus() before ControlClick. Also, you can simply send SHIFT+F10 when you have an item selected. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
matb Posted April 19, 2008 Author Share Posted April 19, 2008 Also, you can simply send SHIFT+F10 when you have an item selected.That might be sufficient. Thanks I would still like to know if there is a way of doing it without using coordinates or hot-keys. Seems like generating right clicks on a TreeView node would be a pretty basic & useful feature. Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2008 Share Posted April 19, 2008 (edited) Look hereEDIT:If you need send right click instead of react on righclick then prepare structures and send WM_NOTIFY with NM_RCLICK to your treeview. Edited April 19, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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