Jump to content

Recommended Posts

Posted (edited)

 

image.png.f92c51932f7b4a0db5ba644a6f1e08be.png

 

 

I'm trying to use mouseclick in a panel above.  I want to click on a list item, such as 'Estimated'.  (I've given up on trying to use control click for this).  I'm using window info coordinates from 'Control' tab.

image.png.250ef461ba8ed00b3bee2ba87390272c.png

; click 'Columns'
WinActivate("Innovaya Studio with Sage (Archtectural 2017_V1.invx")
MouseClick("primary", 292, 88, 1, 1)
WinActivate("Select Browsing Properties")
Sleep(1000)
MouseClick("primary", 27, 70, 0,0)
Sleep(2000)
Send("{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep(1000)
Send("{ENTER}")


ControlClick(

But when I used the code Autoit doesn't click where the coordinates are.  In the scipts it is the second MouseClick that won't work.  Any ideas?

Edited by JNutt
Posted

The app is windows desktop .net.  Someone mentioned before that it may contains a lot of custom widgets, so it seems getting info is difficult.  What other details would be helpful? Like I said I'm a noob here.  Thanks for your help.

I have info from inspect.exe also:

How found:    Focus
RuntimeId:    "[42.3477674.2.2]"
BoundingRectangle:    {l:469 t:404 r:669 b:421}
ProcessId:    11556
ControlType:    UIA_ListItemControlTypeId (0xC357)
LocalizedControlType:    "list item"
Name:    "Estimated"
HasKeyboardFocus:    true
IsKeyboardFocusable:    true
IsEnabled:    true
IsOffscreen:    false
FrameworkId:    "WinForm"
ProviderDescription:    "[pid:11556,hwnd:0x0 Annotation:Microsoft: Annotation Proxy (unmanaged:UIAutomationCore.dll); Main(parent link):Microsoft: ListView Item Proxy (unmanaged:UIAutomationCore.dll)]"
SelectionItem.IsSelected:    true
 

 

Posted

I'd suggest to not use ui automation efl.  people are too quick to suggest that when the controls are standard ones.   use the ones dan recommended.  use controlgethandle to set the variable to pass into them.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted (edited)

your code does not even compile. I don't see correct ControlClick parameters either. Also, WinForms are not so AutoIt friendly which is precisely why IUIAutomation is useful.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

Identifying controls is more complex, but once found, the standard and _gui functions are going to save a ton of time relative the IUIAutomation.  When you can consistently determine the control handles to manipulate in a winform, then you can automate most any application easily.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

Hello I did something similar time ago. You could do something like this.

#include <GuiListView.au3>
#include <WinAPISysWin.au3>


Local $sItemTextToSelect="Luis" ;set item's text to search
Local $sWindowTitle="Form1"     ;set your correct windows title

Local $hWindow = WinActivate($sWindowTitle) ;activate the window
Local $sListViewClassNN = _MakeNetClassNN($hWindow, "SysListView32", "1") ;get Control classNN Make sure set correct list view Instance Index
ConsoleWrite("$sListViewClassNN: " & $sListViewClassNN & @CRLF)

Local $hListView = ControlGetHandle($hWindow, "", $sListViewClassNN) ;get control handle
ConsoleWrite("$hListView: " & $hListView & @CRLF)

Local $iCount = _GUICtrlListView_GetItemCount($hListView) ;get item count (just for testing)
ConsoleWrite("$iCount: " & $iCount & @CRLF)

Local $iFoundItem = _GUICtrlListView_FindText($hListView, $sItemTextToSelect) ;search/match item text
If $iFoundItem > -1 Then
    ConsoleWrite("Item Found Index: " & $iFoundItem & @CRLF)
    _GUICtrlListView_SetItemSelected($hListView, $iFoundItem) ;select the item
EndIf



Func _MakeNetClassNN($hWnd, $sControlType, $sIndexNN)
    Local $iLess = (StringRegExp($sControlType, "STATIC|EDIT|BUTTON|b|Window.b|SysListView32")) ? 0 : 2
    Local $sStringClass = _WinAPI_GetClassName($hWnd)
    Local $sStringWin = StringMid($sStringClass, 1, StringInStr($sStringClass, "."))
    Return $sStringWin & $sControlType & StringMid($sStringClass, StringInStr($sStringClass, ".app") - $iLess) & $sIndexNN
EndFunc   ;==>_MakeNetClassNN

Saludos

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
×
×
  • Create New...