Hawlong Posted November 11, 2018 Share Posted November 11, 2018 i try to click in client area but without activating i use this function for test #include <WinAPIConv.au3> hawlong(438,177) Func hawlong($x,$y) Local $hWnd = HWnd(0x00030540) Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", $x) DllStructSetData($tPoint, "Y", $y) _WinAPI_ClientToScreen($hWnd, $tPoint) $x1 = DllStructGetData($tPoint, "X") $y1 = DllStructGetData($tPoint, "Y") MouseClick("left", $x1, $y1) EndFunc The function works without problems But I want to use ControlClick Like this #include <WinAPIConv.au3> hawlong(438,177) Func hawlong($x,$y) Local $hWnd = HWnd(0x00030540) Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", $x) DllStructSetData($tPoint, "Y", $y) _WinAPI_ClientToScreen($hWnd, $tPoint) $x1 = DllStructGetData($tPoint, "X") $y1 = DllStructGetData($tPoint, "Y") ControlClick($hWnd, "", "[CLASS:#32770; INSTANCE:1]", "left", 1, $x1, $y1) EndFunc The problem is that when i use ControlClick clicks in the wrong place Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 Are the coordinates $x1 and $y1 within the bounds of the control? It's rare that you would ever need to use the x and y coordinates if you're clicking a control. MouseClick coordinates and ControlClick coordinates are completely different things, read the help file. Hawlong 1 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 Are the coordinates $x1 and $y1 within the bounds of the control? _________________________________________ yes bro Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 Not your bro, I hate that term. You might want to read the help file for ControlClick, if they're the same coordinates used in your MouseClick statement above, then they are not coordinates inside the bounds of the control, they might be the coordinates where the control is located, but they aren't the same thing as I stated above. FrancescoDiMuro 1 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 I read it any idea how can click in the right place without moving the cursor (Client Area without activating ) Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 Get rid of the coordinates, as I also stated above, it's very rare that you'd need the coordinates in a ControlClick statement. They're mostly used in trying to click on a taskbar inside of a single control, or a picture element that uses coordinates of the click to determine where you clicked. Other than that, don't use them. 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 Get rid of the coordinates? So how to click on the place I want? I want to click in an empty place where there is no button Link to comment Share on other sites More sharing options...
Nine Posted November 11, 2018 Share Posted November 11, 2018 might be a problem of relative vs absolute coords ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 might be a problem of relative vs absolute coords ? ______________________________________________________ you mean Opt("MouseCoordMode", 2) Opt("MouseCoordMode", 1) Opt("MouseCoordMode", 0) The same problem Link to comment Share on other sites More sharing options...
Nine Posted November 11, 2018 Share Posted November 11, 2018 no i mean mouseclick is by default absolute, while controlclick is relative...unless the window hWnd has 0,0 coord it wont work imo “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 17 minutes ago, Nine said: might be a problem of relative vs absolute coords ? No it's not. 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 ah , Now I understand but is there a solution .. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 23 minutes ago, Hawlong said: I want to click in an empty place where there is no button Show us what you're trying to automate with ControlClick, we need the Summary tab of the Au3Info tool at the very least to know what you're working with. A screenshot of the application and the control you're interacting with would help too. 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 ok , this example to get x and y from client area #include <WinAPIMisc.au3> $hWnd = WinGetHandle("Untitled - Paint") Local $iX = _WinAPI_GetMousePosX() Local $iX2 = _WinAPI_GetMousePosX(True, $hWnd) Local $iY = _WinAPI_GetMousePosY() Local $iY2 = _WinAPI_GetMousePosY(True, $hWnd) MsgBox($MB_SYSTEMMODAL, "Mouse Pos", "X = " & $iX & @CRLF & "Y = " & $iY & @CRLF & @CRLF & _ "Client" & @CRLF & "X = " & $iX2 & @CRLF & "Y = " & $iY2) The second example #include <WinAPIConv.au3> $hWnd = WinGetHandle("Untitled - Paint") Local $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X",259) ; x From the first example DllStructSetData($tPoint, "Y",528) ; y From the first example _WinAPI_ClientToScreen($hWnd, $tPoint) $x1 = DllStructGetData($tPoint, "X") $y1 = DllStructGetData($tPoint, "Y") ControlClick($hWnd, "", "[CLASS:Afx:cf0000:8; INSTANCE:1]", "left", 1, $x1,$y1) I want to click in half the black circle Photo from client area and Au3Info Link to comment Share on other sites More sharing options...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 I ran your second script with Paint open, and it works fine. In your situation, is the paintbrush the active tool or is it still the shape tool? Because it won't show anything if the wrong tool in Paint is active. There's several brush tools that don't show anything unless they're moved, for example. 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 yes , the paintbrush the active tool Link to comment Share on other sites More sharing options...
Developers Jos Posted November 11, 2018 Developers Share Posted November 11, 2018 Ah... you are still screwing around with Paintbrush, like the other thread I closed..... do you seriously think we are that thick? 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...
BrewManNH Posted November 11, 2018 Share Posted November 11, 2018 20 minutes ago, Hawlong said: yes , the paintbrush the active tool Then it's something on your computer, it works as designed on mine, and I'm sure everyone else's copy of "paint". 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 GudeHow 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 Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 ok thanks , i will cheack my computer Link to comment Share on other sites More sharing options...
Hawlong Posted November 11, 2018 Author Share Posted November 11, 2018 jos Link to comment Share on other sites More sharing options...
Recommended Posts