BatMan22 Posted December 13, 2017 Share Posted December 13, 2017 So I have a problem with interacting with Windows inside an old program. I'm wondering if anyone can tell me if it's possible to activate the window in question, and specifically to double click on the "CCBitmap" "Instance8" instead of clicking at co-ordinates.. When I use WinActivate("IC Net") it works fine, because it's the program name.. But WinActivate("HPUV\HPuv_0405_ASFIXED.smt *") does nothing and neither does WinActivate("32770"). Ideas? Link to comment Share on other sites More sharing options...
water Posted December 13, 2017 Share Posted December 13, 2017 To get the exact title of the relevant windows please run the following script while the window you want to automate is active: #include <Array.au3> Opt("WinTitleMatchMode", -2) ; Match any substring in the title, case insensitive match Global $aWindows = WinList("HPUV") ; Lists all windows with string "HPUV" anywhere in the title, case insensitive _ArrayDisplay($aWindows) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
BatMan22 Posted December 13, 2017 Author Share Posted December 13, 2017 Hmm.. tried that. Running the code you posted yields a single Row with "Nothing" in it (single blank row - I assume that's the count? see picture). Changing it to WinList("IC Net") which is the name of the program, yields a single result.. Itself. Which would lead me to believe that autoit cannot "See" the windows inside.. but.. how come Windows Info still sees it? 12 hours ago, water said: To get the exact title of the relevant windows please run the following script while the window you want to automate is active: #include <Array.au3> Opt("WinTitleMatchMode", -2) ; Match any substring in the title, case insensitive match Global $aWindows = WinList("HPUV") ; Lists all windows with string "HPUV" anywhere in the title, case insensitive _ArrayDisplay($aWindows) Link to comment Share on other sites More sharing options...
Earthshine Posted December 13, 2017 Share Posted December 13, 2017 Use the classid. You can copy it direct from the tool. Use the search text with it My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
jdelaney Posted December 13, 2017 Share Posted December 13, 2017 _WinAPI_GetWindow ( $hWnd, $iCmd ) Where $hWnd is the parent window, and $iCmd = 6 (enabled popup). 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. Link to comment Share on other sites More sharing options...
BatMan22 Posted December 14, 2017 Author Share Posted December 14, 2017 2 hours ago, Earthshine said: Use the classid. You can copy it direct from the tool. Use the search text with it Any chance I can get an example of that code? Link to comment Share on other sites More sharing options...
BatMan22 Posted December 14, 2017 Author Share Posted December 14, 2017 1 hour ago, jdelaney said: _WinAPI_GetWindow ( $hWnd, $iCmd ) Where $hWnd is the parent window, and $iCmd = 6 (enabled popup). What? How do I get the $hWnd of the parent window? You mean the program ie "IC Net"? Link to comment Share on other sites More sharing options...
jdelaney Posted December 14, 2017 Share Posted December 14, 2017 WinGetHandle of the main window. 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. Link to comment Share on other sites More sharing options...
BatMan22 Posted December 15, 2017 Author Share Posted December 15, 2017 8 hours ago, jdelaney said: WinGetHandle of the main window. I ran the code below for "IC Net" (main program) , "HPUV\HPuv_0405_ASFIXED.smt" (the window of interest, inside ICNet, copied from WinInfo), and also "HPUV" and "HPUV*". They all returned 0x00000, also the code does work because for "IC Net" when I change iCmd to 1, it returns a real handle. $hWnd = WinGetHandle ( "HPUV\HPuv_0405_ASFIXED.smt" ) $iCmd = 6 $result = _WinAPI_GetWindow ( $hWnd, $iCmd ) MsgBox (0,0, $result) Link to comment Share on other sites More sharing options...
junkew Posted December 15, 2017 Share Posted December 15, 2017 As AU3Inf is recognizing it you should be able to reach it maybe the slash (in the title) is a problem. The window you should be able to click as AU3Inf is recognizing it. Alternatives are simplespy to reveal some information (and identifies a little more objects then AU3Inf). See FAQ 31 for spying tools and location. Clicking the bitmaps in itself in the window I doubt if they are separately recognizable but simplespy will tell you. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
TheDcoder Posted December 15, 2017 Share Posted December 15, 2017 On 14/12/2017 at 3:19 AM, BatMan22 said: Hmm.. tried that. Running the code you posted yields a single Row with "Nothing" in it (single blank row - I assume that's the count? see picture). Yes, that is correct, that is the number of matched windows. Looking by the result of WinList("HPUV"), AutoIt is not able to detect that window for some reason. Can you try WinList() in @water's code example and see if the window appears in the list? If so, copy the data of the row and paste it here on the forums EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
jdelaney Posted December 15, 2017 Share Posted December 15, 2017 copy and paste the main windows 'window tab' spy information here...not a screenshot. 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. Link to comment Share on other sites More sharing options...
BatMan22 Posted December 15, 2017 Author Share Posted December 15, 2017 5 hours ago, jdelaney said: copy and paste the main windows 'window tab' spy information here...not a screenshot. This is all the info window I want to access: expandcollapse popup>>>> Window <<<< Title: HPUV\HPuv_0405_ASFIXED.smt Class: #32770 Position: 171, 156 Size: 744, 309 Style: 0x96CE0054 ExStyle: 0x00050100 Handle: 0x01CC023C >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 362, 169 Cursor ID: 0 Color: 0x042294 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< 0xb2050912 0xdc05058c 0xfb050493 0x6e0507f3 0x7c050797 0x81050797 0x42050445 0x86050415 >>>> Hidden Text <<<< This is all the info for the button I want to click in that window: expandcollapse popup>>>> Window <<<< Title: HPUV\HPuv_0405_ASFIXED.smt Class: #32770 Position: 171, 156 Size: 744, 309 Style: 0x96CE0054 ExStyle: 0x00050100 Handle: 0x01CC023C >>>> Control <<<< Class: CCBitmap Instance: 8 ClassnameNN: CCBitmap8 Name: Advanced (Class): [CLASS:CCBitmap; INSTANCE:8] ID: Text: 0x86050415 Position: 261, 4 Size: 96, 56 ControlClick Coords: 66, 32 Style: 0x54000000 ExStyle: 0x00000000 Handle: 0x01150258 >>>> Mouse <<<< Position: 502, 234 Cursor ID: 0 Color: 0xCECECE >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< 0xb2050912 0xdc05058c 0xfb050493 0x6e0507f3 0x7c050797 0x81050797 0x42050445 0x86050415 >>>> Hidden Text <<<< This is all the info for the main program (that I can call just fine): expandcollapse popup>>>> Window <<<< Title: IC Net Class: MLCWindow Position: -4, -4 Size: 1288, 1002 Style: 0x17CF0000 ExStyle: 0x00040110 Handle: 0x0002018E >>>> Control <<<< Class: MDIClient Instance: 1 ClassnameNN: MDIClient1 Name: Advanced (Class): [CLASS:MDIClient; INSTANCE:1] ID: 32000 Text: Position: 0, 30 Size: 1280, 903 ControlClick Coords: 916, 41 Style: 0x56030001 ExStyle: 0x00000200 Handle: 0x00020164 >>>> Mouse <<<< Position: 916, 109 Cursor ID: 0 Color: 0x808080 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< System state HPUV\HPuv_0405_ASFIXED.smt 0xb2050912 0xdc05058c 0xfb050493 0x6e0507f3 0x7c050797 0x81050797 0x42050445 0x86050415 1712623-006D 218.6_W x2 (HPuv64.mtw)1.run* 1712623-006D 218.6_W x2 (HPuv64.mtw)1.run* C:\Program Files\Metrohm\IC Net 2.2\IC Net\Systems\HPUV\121417.que Help Close Start Pause Edit Shut down system after the queue finishes Close queue dialog window after the queue finishes Watch window(HPUV\HPuv_0405_ASFIXED.smt) DPC Pump pressure 0.2 MPa flow 0.20 mL/min Eluent Pump pressure 7.9 MPa flow 0.70 mL/min 732 IC Detector Abs.Cond -0.10 uS/cm Cond -0.100 uS/cm 762 IC Interface ch2 8.29 mV C:\Program Files\Metrohm\IC Net 2.3\IC Net\ICNet23.bmp 1712616-001A 218.6_W (HPuv64.mtw)_2017-12-14_23-08.chw 1712616-001A 218.6_W (HPuv64.mtw)_2017-12-14_23-08.chw >>>> Hidden Text <<<< Link to comment Share on other sites More sharing options...
BatMan22 Posted December 16, 2017 Author Share Posted December 16, 2017 So I think this might be a case of the programs GUI being written in Java? Does that help? Or does it make things worse? One of the guys mentioned Java, I honestly don't know if he's right or not. Link to comment Share on other sites More sharing options...
BatMan22 Posted December 16, 2017 Author Share Posted December 16, 2017 On 12/15/2017 at 0:41 AM, junkew said: As AU3Inf is recognizing it you should be able to reach it maybe the slash (in the title) is a problem. The window you should be able to click as AU3Inf is recognizing it. Alternatives are simplespy to reveal some information (and identifies a little more objects then AU3Inf). See FAQ 31 for spying tools and location. Clicking the bitmaps in itself in the window I doubt if they are separately recognizable but simplespy will tell you. That Simplespy program is really cool! I love how it highlights the window and spits out hte code for lazy people like me, that being said... I didn't work for me. I am guessing I need to use your Java version. I've attached the screenshout and hte output of the simplyspy is pasted below but the code didn't work for me, it activates the main window but not after that. Either way, It's a really good program, I'm going to try and figure out the Java version of your simplyspy Also when I press Ctrl-W it highlights the correct window/text but the highlighting doesn't show in the screenshot, I don't know why. expandcollapse popuphttps://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/?do=findComment&comment=1156373 At least we have an element title: [] class: [] Having the following values for all properties: Title is: <> Class := <> controltype:= <UIA_TitleBarControlTypeId> ,<50037> , (0000C375) 199;194;151;22 *** Parent Information top down *** 2: Title is: <IC Net> Class := <MLCWindow> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) -7;0;974;1047 "Title:=IC Net;controltype:=UIA_WindowControlTypeId;class:=MLCWindow"" 1: Title is: <Workspace> Class := <MDIClient> controltype:= <UIA_PaneControlTypeId> ,<50033> , (0000C371) 1;81;958;935 "Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=MDIClient"" 0: Title is: <dfgtsdfg *> Class := <#32770> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) 175;186;183;211 "Title:=dfgtsdfg *;controltype:=UIA_WindowControlTypeId;class:=#32770"" ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=IC Net;controltype:=UIA_WindowControlTypeId;class:=MLCWindow") ;IC Net _UIA_setVar("oP2","Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=MDIClient") ;Workspace _UIA_setVar("oP3","Title:=dfgtsdfg *;controltype:=UIA_WindowControlTypeId;class:=#32770") ;dfgtsdfg * ;~ $oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=;controltype:=UIA_TitleBarControlTypeId;class:=") ;ControlType:=UIA_TitleBarControlTypeId;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("oUIElement","highlight") ;~_UIA_action("oUIElement","click") ;~ *** Standard code Flexible*** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP2=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=IC Net;controltype:=UIA_WindowControlTypeId;class:=MLCWindow", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=MDIClient", $treescope_children) _UIA_Action($oP1,"setfocus") Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=dfgtsdfg *;controltype:=UIA_WindowControlTypeId;class:=#32770", $treescope_children) _UIA_Action($oP0,"setfocus") ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") *** Detailed properties of the highlighted element *** UIA_iaccessiblevalue:= <dfgtsdfg *> UIA_iaccessiblechildId:= <0> UIA_handle:= <0> UIA_RuntimeId:= <42;1115452;2;-2147483647;1115452;-2;0> UIA_BoundingRectangle:= <199;194;151;22> UIA_ProcessId:= <11492> UIA_ControlType:= <50037> UIA_LocalizedControlType:= <title bar> UIA_HasKeyboardFocus:= <False> UIA_IsKeyboardFocusable:= <True> UIA_IsEnabled:= <True> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <False> 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:= <False> 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:= <True> UIA_IsWindowPatternAvailable:= <False> UIA_ValueValue:= <dfgtsdfg *> UIA_ValueIsReadOnly:= <False> 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_LegacyIAccessibleValue:= <dfgtsdfg *> UIA_LegacyIAccessibleDescription:= <Displays the name of the window and contains controls to manipulate it> UIA_LegacyIAccessibleRole:= <1> UIA_LegacyIAccessibleState:= <1048576> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:14208,providerId:0x0 Annotation:Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <False> Link to comment Share on other sites More sharing options...
junkew Posted December 17, 2017 Share Posted December 17, 2017 As its 32270 window it can be either regular functions or uia functions. So for first parts it should not matter if you use simplespy or jabsimplespy. What is winlist giving without parameters. Maybe AutoItSetOption("WinTitleMatchMode", 4) influences your trials. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
junkew Posted December 17, 2017 Share Posted December 17, 2017 Maybe this script can also help you to find out if AutoIt can see the window. Have in mind this script has the purpose to explain you in more detail on how to get to the windows so first press the button to fill the combobox FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
BatMan22 Posted December 18, 2017 Author Share Posted December 18, 2017 15 hours ago, junkew said: Maybe this script can also help you to find out if AutoIt can see the window. Have in mind this script has the purpose to explain you in more detail on how to get to the windows so first press the button to fill the combobox That script, I ran it and it killed the main program but it couldn't see any windows inside my program. Link to comment Share on other sites More sharing options...
BatMan22 Posted December 23, 2017 Author Share Posted December 23, 2017 I would love some hints if anyone has another idea as far as where to look/what to do. I also recently found out the software is free so it can be tested locally even without license/machines. If anyone is bored enough to want to test it directly.. 1) The software is free here: https://www.metrohm.com/~/media/files/metrohm/software versions/icnet23sr6.zip?la 2) Run by clicking the IC Net 2.3 icon on your desktop 3) Add a user with whatever name you want (don't forget it, it will ask you it again) and for password just leave it blank 4) For registration just type anything into all 3 fields... Tada, the program is open. I need to be able to call windows in this program, to open a dummy window: Go to File ---> New --> System --> Type in any name ---> Hit Next --> Hit Cancel So now there should be a window open inside that software, I need to ACTIVATE that window (there's usually tons of windows open), and also to able to click on a bitmap in windows like that. WinInfo Tool seems to recognize the window names and also the bitmaps.. but I can't been able to call it successfully in any way I tried. Appreciate the help guys! Link to comment Share on other sites More sharing options...
jdelaney Posted December 23, 2017 Share Posted December 23, 2017 (edited) edit, nevermind Edited December 23, 2017 by jdelaney 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. 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