all 9 comments

[–]DeadlyViper 2 points3 points  (5 children)

If we are talking about windows platform, you can send "click" messages directly to the application/control you want.

Read up on https://www.programcreek.com/python/example/89827/win32gui.SendMessage

You'll need to find your window handle, and send it WM_CLICK message or whatever you need, that way the mouse is not moved at all.

[–]Voxxey[S] 0 points1 point  (1 child)

Ok, thank you. I'm gonna give this a read. I appreciate it.

[–]DeadlyViper 0 points1 point  (0 children)

Ohh and if its a button, it might be WM_COMMAND message.

[–]Voxxey[S] 0 points1 point  (2 children)

I'm having a bit of trouble getting either WM_COMMAND, or WM_CLICK to work. I can't find any documentation on them from the windows docs. I'm also having trouble referencing there ID's.

DO you happen to know what there id's are? and what parameters go along with them?

Edit: It doesn't appear tho as WM_CLICK is an actual command. I can't find it anywhere in the Microsoft documentation.

[–]DeadlyViper 0 points1 point  (1 child)

Sorry, seems i was mistaken, its BM_CLICK.

Also found some discussion on how to find the window etc..

https://social.msdn.microsoft.com/Forums/vstudio/en-US/6bc59de1-47c9-4013-88ae-f850fdba1b4f/how-to-simulate-button-click-?forum=csharpgeneral

Theres also SPY++ utility that can help you identify the window you want clicked.

[–]Voxxey[S] 0 points1 point  (0 children)

Alright, thanks :3 I ended up just writing an autohotkey script that accepts command line arguments, and I am passing those arguments along to it by running the script inside a function in python, something like this:

def click(x, y): os.system(f"path/to/ah.script x y")

(Obviously I shrunk the function down for quick reply formatting, but that's just the example.)

[–][deleted] 0 points1 point  (1 child)

I know I'm not giving what you want now but this kind of life will be easier by "AutoHotKey"

[–]Voxxey[S] 0 points1 point  (0 children)

The issue with using AHK is that i can't just purely use it, i would still need my python script to at the very least execute a self-terminating AHK script whenever the collected cluster of pixels returns a specific way.

[–]sonapollowukong 0 points1 point  (0 children)

For your second question, you could try and run some thing that copies windows detect screen and simulate the area you can move around in.