I wrote a program to click on an application automatically at scheduled time using Win32, using MOUSE_DOWN
and MOUSE_UP
. It usually works well, except I found that I need to put in a
sleep 0.1
between the MOUSE_DOWN
and MOUSE_UP
. (using Ruby, which allows sleeping a fraction of a second).
Without the sleep, sometimes the click doesn't go through. But I noticed that sometimes, the click is "too long". The click is actually on a Flash app's Right Arrow. This right arrow will go to the next item on a list. So if you MOUSE_DOWN
for a little longer, it actually will shift 2 or 3 items instead of just 1 item.
So I wonder, is there a way to accurately simulate 1 click in this case. Probably there is no MOUSE_CLICK
event? It has to be simulated using MOUSE_DOWN
and MOUSE_UP
?
(it is actually called MOUSEEVENTF_LEFTDOWN
and MOUSEEVENTF_LEFTUP
on Win32, just for simplicity it is stated as MOUSE_DOWN
instead.)