phat_2008 Posted June 29, 2022 Share Posted June 29, 2022 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? expandcollapse popup#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 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