ControlClick, How dose it work? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 22
Joined: 09 Aug 2018, 04:41

ControlClick, How dose it work?

14 Sep 2018, 06:05


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 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 :)

Posts: 440
Joined: 28 Apr 2018, 21:59

Re: ControlClick, How dose it work?  Topic is solved

14 Sep 2018, 07:27

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 ( ... 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

Code: Select all

ControlClick, x500 y500, Untitled - Notepad,, WD, 5
Note for this example to work it has to be used on an Untitled notepad (ie don't save).
Posts: 22
Joined: 09 Aug 2018, 04:41

Re: ControlClick, How dose it work?

17 Sep 2018, 08:15

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! :dance:

Code: Select all

SetTitleMatchMode 2
Loop, 10
Random, randx, 200, 500
Random, randy, 200, 500
ControlClick, x%randx% y%randy%,Paint,,Left

Return to “Ask For Help”

Who is online

Users browsing this forum: LeonAskin, Spawnova, wineguy, XMCQCX and 60 guests