Hello,
So I wanted to make a script that works in the background. Pritty simple, I want to script to click at XYPos in a chrome window that I have on a second monitor or in the background, while I do other things on another monitor, or foreground.
I was looking around and found that people suggest using ControlClick.
After reading https://autohotkey.com/docs/commands/ControlClick.htm I am still unsure on what the function do. Anyone care to enlighten me on the subject and maybe give an example?
I am pritty new to AHK scriptning, but if I understand how to use the function I can figure out the rest myself
Thanks!
ControlClick, How dose it work? Topic is solved
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: ControlClick, How dose it work? Topic is solved
So how the function works is that it looks for a specific window/control that you specify and will send the mouse control (either left right or the scroll wheel) to that control/window. For your purposes what you want is the second line under the examples section. With that you will most likely need to specify the SetTitleMatchMode (https://autohotkey.com/docs/commands/Se ... chMode.htm) in order to send the click correctly. As for example we will use Notepad for this. As a test we will send a scroll wheel event to that window so if you fill out notepad with random data and have it activate the scroll bar then this example can work
Note for this example to work it has to be used on an Untitled notepad (ie don't save).
Code: Select all
ControlClick, x500 y500, Untitled - Notepad,, WD, 5
Re: ControlClick, How dose it work?
Thank you so much for the respond! I think i have most of it figured out now. Took me some time to understand SetTitleMatchMode.
Also changed over from notepad to Paint to realy see the workings.
Thanks alot!
Also changed over from notepad to Paint to realy see the workings.
Thanks alot!
Code: Select all
Escape::Reload
Numpad9::
SetTitleMatchMode 2
Loop, 10
{
Random, randx, 200, 500
Random, randy, 200, 500
ControlClick, x%randx% y%randy%,Paint,,Left
}
return
Who is online
Users browsing this forum: No registered users and 294 guests