Terje Johan Abrahamsen wrote:
> Hello.
>
> I have been trying desperately for a while to make Python push the
> left mousebutton. I have been able to let Python push a button in a
> box:
>
> def click(hwnd):
> win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, 0)
> win32gui.SendMessage
This could be fun!
# random clicks
# play with values to maximize annoyance
if __name__ == "__main__":
import random
for i in range(1000):
x = random.randint(0,800)
y = random.randint(0,600)
Click(x,y)
time.sleep(random.randint(0,20))
--
http://mail.python.
I did this a little while ago, there's some setup stuff in here for
sending keyboard commands as well. Coercing the structs into python was
the hardest part. Basically Click(x,y) moves the mouse to the specified
spot on the screen (not window) sends a mouse down followed by mouse up
event then retu
Benji York wrote:
> Terje Johan Abrahamsen wrote:
> > I have been trying desperately for a while to make Python push the
> > left mousebutton.
>
> Here's some code I've used to simulate a *right* click, but it should
> be obvious how to make it do what you want:
>
> void sendRightClick(void)
> {
Benji York wrote:
> Terje Johan Abrahamsen wrote:
> > I have been trying desperately for a while to make Python push the
> > left mousebutton.
>
> Here's some code I've used to simulate a *right* click, but it should
> be obvious how to make it do what you want:
>
> void sendRightClick(void)
> {
Terje Johan Abrahamsen wrote:
> I have been trying desperately for a while to make Python push the
> left mousebutton.
Here's some code I've used to simulate a *right* click, but it should
be obvious how to make it do what you want:
void sendRightClick(void)
{
PostMessage(GetForegroundWindo