
phat_2008
Members-
Posts
4 -
Joined
-
Last visited
phat_2008's Achievements

Seeker (1/7)
0
Reputation
-
IUIAutomation MS framework automate chrome, FF, IE, ....
phat_2008 replied to junkew's topic in AutoIt Example Scripts
Thank junkew for the reply. When Using Spy the Parent groups highlighted are two different icons/buttons but both uses the same property values. When using inspect.exe there's no object property that I can use to invoke some clicking. Inspect.exe -
IUIAutomation MS framework automate chrome, FF, IE, ....
phat_2008 replied to junkew's topic in AutoIt Example Scripts
Hello, I have been using this tool for a while and I like it and now I'm running into a roadblock. I'm able to script where I can open this program, open the UIA_MenuItemControlTypeId based on my criteria. Then a popup menu opens. After that, I am not able to get any elements because it's reading Chrome_RenderWiedgetHostWHND. The pop up menu titled "ANALOG_3_1" has multiple buttons and I'd like to click on the one that says "Detail" (when my mouse hovers to this button it says Detail". But there's no way of determining what the name actually is. So I just hit CTRL+W on this button below is what I have. I also tried to do something with the UIA_BoundingRectangle properties but no luck. Any suggestions? UIA_BoundingRectangle:= <1012;541;18;18> ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=DeltaV Live;controltype:=UIA_WindowControlTypeId;class:=Window") ;Inhouse software _UIA_setVar("oP2","Title:=ANALOG_3_1;controltype:=UIA_WindowControlTypeId;class:=Window") ;ANALOG_3_1 _UIA_setVar("oP3","Title:=Display Viewer Shell;controltype:=UIA_CustomControlTypeId;class:=ShellView") ;Display Viewer Shell _UIA_setVar("oP4","Title:=Graphic Host;controltype:=UIA_CustomControlTypeId;class:=GraphicHostView") ;Graphic Host _UIA_setVar("oP5","Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsFormsHost") ; _UIA_setVar("oP6","Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.34cbfc8_r9_ad1") ; _UIA_setVar("oP7","Title:=;controltype:=UIA_PaneControlTypeId;class:=CefBrowserWindow") ; _UIA_setVar("oP8","Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_0") ; _UIA_setVar("oP9","Title:=Inhouse Software;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND") ;Inhouse software _UIA_setVar("oP10","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP11","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP12","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP13","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP14","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP15","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP16","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; _UIA_setVar("oP17","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ; ;~ $oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_GroupControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=;controltype:=UIA_GroupControlTypeId;class:=") ;ControlType:=UIA_GroupControlTypeId;classname:=") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") ;~_UIA_Action("oP4","highlight") _UIA_Action("oP4","setfocus") ;~_UIA_Action("oP5","highlight") _UIA_Action("oP5","setfocus") ;~_UIA_Action("oP6","highlight") _UIA_Action("oP6","setfocus") ;~_UIA_Action("oP7","highlight") _UIA_Action("oP7","setfocus") ;~_UIA_Action("oP8","highlight") _UIA_Action("oP8","setfocus") ;~_UIA_Action("oP9","highlight") _UIA_Action("oP9","setfocus") ;~_UIA_Action("oP10","highlight") _UIA_Action("oP10","setfocus") ;~_UIA_Action("oP11","highlight") _UIA_Action("oP11","setfocus") ;~_UIA_Action("oP12","highlight") _UIA_Action("oP12","setfocus") ;~_UIA_Action("oP13","highlight") _UIA_Action("oP13","setfocus") ;~_UIA_Action("oP14","highlight") _UIA_Action("oP14","setfocus") ;~_UIA_Action("oP15","highlight") _UIA_Action("oP15","setfocus") ;~_UIA_Action("oP16","highlight") _UIA_Action("oP16","setfocus") ;~_UIA_Action("oP17","highlight") _UIA_Action("oP17","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click") ;~ *** Standard code Flexible*** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP16=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=DeltaV Live;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP16,"setfocus") Local $oP15=_UIA_getObjectByFindAll($oP16, "Title:=ANALOG_3_1;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP15,"setfocus") Local $oP14=_UIA_getObjectByFindAll($oP15, "Title:=Display Viewer Shell;controltype:=UIA_CustomControlTypeId;class:=ShellView", $treescope_children) Local $oP13=_UIA_getObjectByFindAll($oP14, "Title:=Graphic Host;controltype:=UIA_CustomControlTypeId;class:=GraphicHostView", $treescope_children) Local $oP12=_UIA_getObjectByFindAll($oP13, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsFormsHost", $treescope_children) _UIA_Action($oP12,"setfocus") Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.34cbfc8_r9_ad1", $treescope_children) _UIA_Action($oP11,"setfocus") Local $oP10=_UIA_getObjectByFindAll($oP11, "Title:=;controltype:=UIA_PaneControlTypeId;class:=CefBrowserWindow", $treescope_children) _UIA_Action($oP10,"setfocus") Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_0", $treescope_children) _UIA_Action($oP9,"setfocus") Local $oP8=_UIA_getObjectByFindAll($oP9, "Title:=DeltaV Operations;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children) _UIA_Action($oP8,"setfocus") Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_GroupControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_GroupControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") *** Detailed properties of the highlighted element *** UIA_iaccessiblechildId:= <0> UIA_handle:= <0> UIA_BoundingRectangle:= <1012;541;18;18> UIA_ProcessId:= <12272> UIA_ControlType:= <50026> UIA_LocalizedControlType:= <group> UIA_HasKeyboardFocus:= <False> UIA_IsKeyboardFocusable:= <False> UIA_IsEnabled:= <True> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_IsRequiredForForm:= <False> UIA_IsDockPatternAvailable:= <False> UIA_IsExpandCollapsePatternAvailable:= <False> UIA_IsGridItemPatternAvailable:= <False> UIA_IsGridPatternAvailable:= <False> UIA_IsInvokePatternAvailable:= <True> UIA_IsMultipleViewPatternAvailable:= <False> UIA_IsRangeValuePatternAvailable:= <False> UIA_IsScrollPatternAvailable:= <False> UIA_IsScrollItemPatternAvailable:= <False> UIA_IsSelectionItemPatternAvailable:= <False> UIA_IsSelectionPatternAvailable:= <False> UIA_IsTablePatternAvailable:= <False> UIA_IsTableItemPatternAvailable:= <False> UIA_IsTextPatternAvailable:= <False> UIA_IsTogglePatternAvailable:= <False> UIA_IsTransformPatternAvailable:= <False> UIA_IsValuePatternAvailable:= <False> UIA_IsWindowPatternAvailable:= <False> UIA_ValueIsReadOnly:= <True> UIA_RangeValueValue:= <0> UIA_RangeValueIsReadOnly:= <True> UIA_RangeValueMinimum:= <0> UIA_RangeValueMaximum:= <0> UIA_RangeValueLargeChange:= <0> UIA_RangeValueSmallChange:= <0> UIA_ScrollHorizontalScrollPercent:= <0> UIA_ScrollHorizontalViewSize:= <100> UIA_ScrollVerticalScrollPercent:= <0> UIA_ScrollVerticalViewSize:= <100> UIA_ScrollHorizontallyScrollable:= <False> UIA_ScrollVerticallyScrollable:= <False> UIA_SelectionCanSelectMultiple:= <False> UIA_SelectionIsSelectionRequired:= <False> UIA_GridRowCount:= <0> UIA_GridColumnCount:= <0> UIA_GridItemRow:= <0> UIA_GridItemColumn:= <0> UIA_GridItemRowSpan:= <1> UIA_GridItemColumnSpan:= <1> UIA_DockDockPosition:= <5> UIA_ExpandCollapseExpandCollapseState:= <3> UIA_MultipleViewCurrentView:= <0> UIA_WindowCanMaximize:= <False> UIA_WindowCanMinimize:= <False> UIA_WindowWindowVisualState:= <0> UIA_WindowWindowInteractionState:= <0> UIA_WindowIsModal:= <False> UIA_WindowIsTopmost:= <False> UIA_SelectionItemIsSelected:= <False> UIA_TableRowOrColumnMajor:= <2> UIA_ToggleToggleState:= <2> UIA_TransformCanMove:= <False> UIA_TransformCanResize:= <False> UIA_TransformCanRotate:= <False> UIA_IsLegacyIAccessiblePatternAvailable:= <True> UIA_LegacyIAccessibleChildId:= <0> UIA_LegacyIAccessibleRole:= <20> UIA_LegacyIAccessibleState:= <0> UIA_LegacyIAccessibleDefaultAction:= <click ancestor> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:12272,hwnd:0x0 Main(parent link):Microsoft: MSAA Proxy (unmanaged:UIAutomationCore.dll)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <False> UIA_OptimizeForVisualContent:= <False> UIA_IsObjectModelPatternAvailable:= <False> UIA_AnnotationAnnotationTypeId:= <0> UIA_IsAnnotationPatternAvailable:= <False> UIA_IsTextPattern2Available:= <False> UIA_StylesStyleId:= <0> UIA_StylesFillColor:= <0> UIA_StylesFillPatternColor:= <0> UIA_IsStylesPatternAvailable:= <False> UIA_IsSpreadsheetPatternAvailable:= <False> UIA_IsSpreadsheetItemPatternAvailable:= <False> UIA_Transform2CanZoom:= <False> UIA_IsTransformPattern2Available:= <False> UIA_LiveSetting:= <0> UIA_IsTextChildPatternAvailable:= <False> UIA_IsDragPatternAvailable:= <False> UIA_DragIsGrabbed:= <False> UIA_DragDropEffects:= <True> UIA_IsDropTargetPatternAvailable:= <False> UIA_DropTargetDropTargetEffects:= <True> UIA_Transform2ZoomLevel:= <1> UIA_Transform2ZoomMinimum:= <1> UIA_Transform2ZoomMaximum:= <1> UIA_IsTextEditPatternAvailable:= <False> UIA_IsPeripheral:= <False> UIA_IsCustomNavigationPatternAvailable:= <False> UIA_PositionInSet:= <0> UIA_SizeOfSet:= <0> UIA_Level:= <0> UIA_LandmarkType:= <0> -
Hi All, I have this script that is working but I'm not sure if it's the right approach. I am still learning on how to properly make this better. I am looking to loop the function based on number I entered for the number of times I want this function to run. Once it reached that number the script should stop. Also, how can I make it where the script can be paused/closed by pressing Esc key? #include "D:\_AutoIt\SimeplySpy-Examples_V0_70\UIA_V0_70\UIAWrappers.au3" ;Start InHouseSoftware $title = ("InHouseSoftware") If WinExists($title) Then Else Run("C:\Program Files (x86)\Folder\InHouseSoftware.exe","", @SW_SHOWDEFAULT) WinWaitActive($title) Sleep(9000) EndIf ConsoleWrite("Detecting Parent Elements") AutoItSetOption("MustDeclareVars", 1) Local $oP17=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=InHouseSoftware;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP17,"setfocus") Local $oP16=_UIA_getObjectByFindAll($oP17, "Title:=Operations Hub Shell;controltype:=UIA_CustomControlTypeId;class:=ShellView", $treescope_children) Local $oP15=_UIA_getObjectByFindAll($oP16, "Title:=;controltype:=UIA_PaneControlTypeId;class:=ScrollViewer", $treescope_children) Local $oP14=_UIA_getObjectByFindAll($oP15, "Title:=Layout Host;controltype:=UIA_CustomControlTypeId;class:=LayoutHostView", $treescope_children) Local $oP13=_UIA_getObjectByFindAll($oP14, "Title:=;controltype:=UIA_CustomControlTypeId;class:=WidgetHostControl", $treescope_children) Local $oP12=_UIA_getObjectByFindAll($oP13, "Title:=Display Viewer Shell;controltype:=UIA_CustomControlTypeId;class:=ShellView", $treescope_children) Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Navigation Bar;controltype:=UIA_CustomControlTypeId;class:=NavigationBarView", $treescope_children) Local $oP10=_UIA_getObjectByFindAll($oP11, "Title:=Display List;controltype:=UIA_CustomControlTypeId;class:=DisplayListView", $treescope_children) Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) Local $oP8=_UIA_getObjectByFindAll($oP9, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=Oe.DisplayViewerWidget.Presentation.Model.UI.NavigationBar.DisplayList.DisplayListItemViewModel;controltype:=UIA_ListItemControlTypeId;class:=ListBoxItem", $treescope_children) Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=Display List Item;controltype:=UIA_CustomControlTypeId;class:=DisplayListItemView", $treescope_children) Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Alarm List;controltype:=UIA_ButtonControlTypeId;class:=Button", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_WindowControlTypeId;class:=Popup", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_ScrollBarControlTypeId;class:=ScrollBar", $treescope_children) ;-------------------This pops up the menu item-------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") ;Detects the scroll bar _UIA_setVar("oP2","Title:=;controltype:=UIA_ScrollBarControlTypeId;class:=ScrollBar") _UIA_Action("oP2","setfocus") ;click down _UIA_setVar("oUIElement","Title:=M 0 0 L 4 4 L 8 0 Z;controltype:=UIA_ButtonControlTypeId;class:=RepeatButton") ;ControlType:=UIA_ButtonControlTypeId;classname:=RepeatButton") _UIA_action("oUIElement","highlight") Sleep(1000) ;--------------------Select the first display-------------------; _UIA_setVar("$oUIElement","Title:=PERF2_025G_0350D_01_30;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") _UIA_action("$oUIElement","click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display global $count = 0 global $numberOfTimes = 80 while($count < $numberOfTimes) DisplayCycle() Sleep(2000) WEnd Func DisplayCycle() ;--------------------Select the second display-------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") Local $oUIElement=_UIA_getObjectByFindAll($oP10, "title:=PERF2_025G_0350D_02_30;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display ;--------------------Select the third display-------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") Local $oUIElement=_UIA_getObjectByFindAll($oP10, "title:=PERF2_025G_0350D_03_30;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display ;-------------------Select the fourth display-------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") Local $oUIElement=_UIA_getObjectByFindAll($oP10, "title:=PERF2_025G_0350D_04_30;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display ;-------------------Select the fifth display-------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") Local $oUIElement=_UIA_getObjectByFindAll($oP10, "title:=PERF2_025G_0350D_05_30;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display ;--------------------Scroll Up to get the proper list-----------; ;-------------------This pops up the menu item------------------; Local $oUIElement=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_action($oUIElement,"click") ;--------------------Detects the scroll bar---------------------; _UIA_setVar("oP2","Title:=;controltype:=UIA_ScrollBarControlTypeId;class:=ScrollBar") _UIA_Action("oP2","setfocus") ;Detects the Up bar _UIA_setVar("oUIElement","Title:=M 0 4 L 8 4 L 4 0 Z;controltype:=UIA_ButtonControlTypeId;class:=RepeatButton") ;ControlType:=UIA_ButtonControlTypeId;classname:=RepeatButton") Local $oUIElement=_UIA_getObjectByFindAll($oP2, "title:=M 0 4 L 8 4 L 4 0 Z;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) ;clicks UP = "5" _UIA_action($oUIElement,"click") _UIA_action($oUIElement,"click") _UIA_action($oUIElement,"click") _UIA_action($oUIElement,"click") _UIA_action($oUIElement,"click") Sleep(1000) ;--------------------Select the first display-------------------; _UIA_setVar("$oUIElement","Title:=PERF2_025G_0350D_01_30;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") _UIA_action("$oUIElement","click") Sleep(8000) ;Change this value (miliseconds) to the number of seconds(per 1000ms) you wish before it change to the next display EndFunc
-
I'm a newb at this and for someone who has never done this before is having extreme difficulty creating my first ui automation. Was hoping they'd be some video instructions which would validate the instruction 100%. I do appreciate the work with autoit and I think it's going to take me some time. I've already spent a week but no success.