Jump to content
MaximusCZ

ControlClick seems not to work with certain elemtents

Recommended Posts

MaximusCZ

Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.

I have a problem where I try to send a control clink into to a window. 
Part of window I try to send clicks to looks like this control.png.72dc1c0aceea9bfc92cd7c45d4cf6570.png. The black border is showing when I mouse over it Au3Info, I get following information:

control2.png.5f29d3eb79673738631a343fcf0e1586.png

I am testing its interaction with code

control3.png.d1656008ed10121452dd2350bb0fd0ad.png

The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.

When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 

Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.

 

Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.

Help :(

 

Share this post


Link to post
Share on other sites
Earthshine

Tip. Don’t post pictures. Post your code so others can help. 


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
MaximusCZ

Earthshine: The picture of code is just to give you idea of what I am doing: test-clicking in a row to see where the clicks register. Having this in copy-able format doesnt help anybody, as I dont think anyone have the program in question.

Share this post


Link to post
Share on other sites
Earthshine

It doesn’t matter.  We are here to help you improve it and there are those here who will just hand over code so you should show something besides a pic. Also you have no logging so you have no idea what’s going on


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
MaximusCZ
Posted (edited)

I have no idea how to approach you at this point, and I got the feeling you either not read my post, or misunderstood the issue compleately.

My code is really just one line of code, that will not work anywhere else besides my PC, as explained before. Noone can test it, run it or do anything with it, whether I post a pic or code, and its not even desired to be able so. I will not distribute the program this script interact with, so there is not a single point of initiative for others to play with the code. I only posted to pic to give a general idea of what I am doing (that is, sending control click and example parameters, activating the window beforehand and showing a loop I am using to send this single line of code multipletimes), and provided a verification that its working in a certain part of a program, so there is no dispute about whether the line is good as is. 

I still dont see how sharing a single line of code could help anyone solve this, as they would still be missing the end program to test it with. 

The main concern of mine is if someone encountered similar issue, possibly with an idea of working with such unresponsive elements, they could share their insights.

 

So far your tip and following paragraph are unhelpfull and needless, so if you have no intention of actually helping solve the original issue, I am gonna ask you to please refrain from any more comments regarding the issue you found (and tried to validate) with my post.

 

Edited by MaximusCZ

Share this post


Link to post
Share on other sites
BrewManNH

The coordinates in your ControlClick, are they the control coordinates, or the window coordinates? The ControlClick coordinates are the position inside the control bounds, so if you're using window coordinates, you're clicking in the wrong place.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
MaximusCZ

I am clicking in control coordinates. Right position of clicks was already verified

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

well, I did some research on the control, and the good news is, that products like WinTask can use it through UI Automoation. FAQ 31 has a link for the IUIAutomation kit should all else fail. It has a SimpleSpy application that can find all the UI elements and their properties too.

When I first saw your post, I thought, oh boy, some old ActiveX OCX. I know from personal experience with them that they can be problematic when trying to interact with in standard AutoIT.

Anyway, good luck.

I just wanted to add that I needed the IUIAutomation kit for the old OCXs and applications if I was to do anything in AutoIT, even in one case it was just to get it to focus on the control so I can send key commands to it (that's how locked down they can be)

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

And, looking into WinTask, that looks like an amazing wrapper for UIAutomation using a VB syntax and a script generator/recorder. $299 for two years support, but it might be well worth it. I know i could whip up all the regression scripts for our products fast with it, and, if it worked with our old VB6 apps and controls, it would rule. this research lead me to that product. It can easily handle any WPF or WinForms, I am going to get the free trial to see if I can automate that horrid vb6 ocx.

Edited by Earthshine
  • Like 1

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

so, i got WinTask free 30 day trial and already have whipped up a fair flame test. who knew it could be this easy. it's super fast and handles Winforms, WPF and VB6 and EVEN JAVA apps. Who knew? Buying it. Handles browsers too.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

UIPath? Now I need to know more. I’ll be fully shaking WinTask down for 30 days

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • Yirrlaar
      By Yirrlaar
      #Include <WinAPI.au3> local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]"))) ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary") When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"
      When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.
      Upon click the button it should be clicking it, I see the following inn the console window:
      If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???
    • Tats
      By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • Skysnake
      By Skysnake
      I need to automate a specific GUI from a legacy system written in C.
      The spy tool gives me this

      I use this code
      Local $swintit = WinGetTitle("[active]") ConsoleWrite("active Window " & $swintit & @CRLF) If $swintit = "FILES NOTES" Then ; If $swintit = "FILES NOTES" Then ; got Window, now atomate ConsoleWrite("got Window " & @CRLF) ; now focus, then click :) ;EditPaste ;ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(404, $GUI_Focus) ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(401, $GUI_Focus) ControlClick("FILES NOTES", "", 401, $acno) ; click okay EndIf ; If $swintit = "FILES NOTES" Then The idea is to paste the acno value into the edit box, then click an Okay button.
      I get a console write that the active Window is as expected, but my loop completes without ever writing anything into the GUI.
      I also tried the control ID as text "404" - same result
      What am I missing?
      Skysnake
       
    • JNutt
      By JNutt
       

       
       
      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.

      ; 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?
    • Miliardsto
      By Miliardsto
      Hello I got this script works below and I want to do not move cursor on screen when action is performed.
      Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y,0) MouseClick("right", $x, $y)) MouseMove($xMiddle, $yMiddle,0) MouseClick("left", $xMiddle, $yMiddle) EndIf I changed this above to this below and what happen is. It clicks right button and then left button but not move mouse to $x $y and then to $xMiddle $yMiddle.
      Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then ControlClick("","",0,"secondary",1,$x,$y) ControlClick("","",0,"primary",1,$xMiddle,$yMiddle) EndIf If needed I got handle in var $hwnd
      Please tell me how parameters in ControlClick would like be
×