Make a certain area of a program unclickable

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bal89
Posts: 2
Joined: 22 Oct 2021, 03:43

Make a certain area of a program unclickable

Post by bal89 » 22 Oct 2021, 04:07

Hello everyone.
I'm using a program called playnite , and I would like to make some parts of the program for example the settings button not to be able to be clicked.
One method i thought to do that is to place an transparent box there in front of the setting button. Any ideas how can be done that ?
Also im not very familiar with autohotkey i could say im newbie so please the answers if it possible to be as clear as it could be. ;)

User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Make a certain area of a program unclickable

Post by boiler » 22 Oct 2021, 05:05

I would make an LButton hotkey that is only active when that window is active (see #IfWinActive) and it would only click after checking that it is not over a keep-out area of the window. Using MouseGetPos, you can determine where the mouse is relative to the upper-left corner of the window.

bal89
Posts: 2
Joined: 22 Oct 2021, 03:43

Re: Make a certain area of a program unclickable

Post by bal89 » 22 Oct 2021, 05:18

boiler wrote:
22 Oct 2021, 05:05
I would make an LButton hotkey that is only active when that window is active (see #IfWinActive) and it would only click after checking that it is not over a keep-out area of the window. Using MouseGetPos, you can determine where the mouse is relative to the upper-left corner of the window.
Thank you for the reply!
Wonderning how i will fire the LButton:return command when the values that I will get from MouseGetPos method will match with the position of my mouse ..
Any advice? :angel:

User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Make a certain area of a program unclickable

Post by boiler » 22 Oct 2021, 05:43

You don’t use it as simply return. The question is more of when do you have it execute the Click command, and you would have it do that after determining that the coordinates of the mouse position are in an allowable area of the window. Something like:

Code: Select all

#IfWinActive, YourWindowTitle
LButton::
	MouseGetPos, MX, MY
	if !((MX >= 300) && (MX <= 360) && (MY >= 200) && (MY <= 230))
		Click
return

The above would click if the mouse is outside of the rectangle defined by upper-left coordinate (300, 200) and lower-right coordinate (360, 230), relative to the window’s upper-left corner.


Alternatively, you could do something similar to what you proposed by creating a function that would be called as part of an #If directive, similar to the MouseIsOver() example. So something like:

Code: Select all

#If MouseIsOverProtected()
LButton::return
Then you would have to write that function to determine if the mouse is over the window of interest and over an area in which you want to prevent clicks.

Post Reply

Return to “Ask for Help (v1)”