cag8f Posted June 6, 2023 Share Posted June 6, 2023 Hi all. I'm trying to use AutoIt to click a button in a Windows screenshot program named ShareX, but am having difficulty. I've used Au3Info.exe to get information about the control (see screenshot below). After, I added the following line to a file, and executed the code. How can I troubleshoot and resolve? ControlClick("ShareX - Editor menu", "", 199150) This prints the following to the console: 0 As a fallback, I guess I can send a mouse click to a certain XY coordinate. But before that I'd like to understand why this isn't working. Thanks in advance. Here is info about my control, as well as a screenshot of the Window in-question, and the control I want to click. One item of note is that the ID value is not contant--it changes every time the window is opened. But the Title and Class values remain constant. Link to comment Share on other sites More sharing options...
Andreik Posted June 6, 2023 Share Posted June 6, 2023 Try this: AutoItSetOption('WinTitleMatchMode', 2) ControlClick('ShareX - Editor menu', '', 'WindowsForms10.Window.8.app.0.1a52015_r6_ad111') When the words fail... music speaks. Link to comment Share on other sites More sharing options...
cag8f Posted June 7, 2023 Author Share Posted June 7, 2023 OK thanks very much for the help. Progress was made, if at least by my failures 🙂 I tried your code. There was no change in result. The control was still unclicked and the function returned 0. But, I noticed that you have an extra `1` at the end of the string in your final parameter: you have `ad111` instead of `ad11` I tried your code, with the extraneous `1` removed. There was a slight change in result. The control was still unclicked, but the function returned 1 instead of 0. I tried your code, with two `1`s removed (to match the value for Class instead of Class์ameNN. There was no change in result. The control was still unclicked and the function returned 0. I tried changing the final parameter to: 'ShareX - Editor menu' There was no change in result. The control was still unclicked and the function returned 0. Thoughts? If I recall, AutoIt doesn't promise to always be able to send a click to a control. Is this one of those cases? Link to comment Share on other sites More sharing options...
Solution bogQ Posted June 7, 2023 Solution Share Posted June 7, 2023 (edited) (Size: w=1708, h=32) = your control is a entire toolbar and not a single button or similar control. in autoit window info tool go under "Options" to enable "Highlight Controls" for more help. just calling ControlClick will do click to the middle of a control, try using optional ControlClick parameters for that control regarding X,Y click position (use ControlClick Coords from window info tool), other way to try is mouseclick Edited June 7, 2023 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
cag8f Posted June 7, 2023 Author Share Posted June 7, 2023 (edited) OK bingo that was it--good eye, and thanks! FYI I specified the coordinates of the control when calling ControlClick, and that worked for me. Edited June 7, 2023 by cag8f Link to comment Share on other sites More sharing options...
Andreik Posted June 7, 2023 Share Posted June 7, 2023 I am not sure if you highlighted the button or the toolbar (I assumed that you highlighted the button) and it's not an extra 1, it's ClassnameNN + Instance. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
cag8f Posted June 7, 2023 Author Share Posted June 7, 2023 OK noted, sorry for that misunderstanding. But I do appreciate the help. Good learning exercise. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 7, 2023 Developers Share Posted June 7, 2023 Ok, I will unlock that last topic and cleanup the last couple of posts in this thread in a couple of minutes to clean things up, but please don't go crazy with creating topics. bogQ and cag8f 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts