HI, I have a problem imitating a mouse-over or mouse-hover event with my script. I work on a window of a Windows app downloaded from a remote website to communicate with the website. I want my script to know when a section of the screen becomes clickable. When this happens the section changes colour in response to the mouse cursor hovering over a point X, Y.
X, Y might be on a button, or it might just be part of a graphic. I have tried doing a MouseMove to X,Y and checking the colour. I have tried a Sleep after moving to X, Y. I have tried a Click, X, Y, 0, I have tried a slow MouseMove from a point to the left of X, Y to a point on the other side. Nothing seems to fool the app into thinking it is my real mouse cursor there. There is no colour change to indicate X, Y can be clicked
Leaving the real cursor over X, Y or nearby X, Y does work most of the time but I don’t think that’s a very good solution. The script should be able to do it. Of course I have the correct X, Y and I use WinActivate and CoordMode before the colour check and the mouse moves and clicks.
Less important, but on the same subject, how do I get the mouse cursor to move from A to B in a realistic manner instead of flashing up sometimes at A and flashing up sometimes at B?
I’m not very experienced with autohotkey. I’ve seen several mentions of this here and there but nothing that I can get to work the way I want.
Thanks if you can help
Simulating mouse over, mouse hover
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Simulating mouse over, mouse hover
Try mousemove and play with the speedahkwipper wrote: Less important, but on the same subject, how do I get the mouse cursor to move from A to B in a realistic manner instead of flashing up sometimes at A and flashing up sometimes at B?
Thanks if you can help
https://autohotkey.com/docs/commands/MouseMove.htm
Re: Simulating mouse over, mouse hover
Can you navigate these buttons with the arrow and/or enter keys?
if so, you could just use keystrokes.
If that fails, run as administrator and cross your fingers
if so, you could just use keystrokes.
If that fails, run as administrator and cross your fingers
Re: Simulating mouse over, mouse hover
Thanks
AHKSudent - as I said, I've tried a slow mousemove over X, Y. Not only does it not trigger a colour change in the area of interest, but the cursor does not appear as a steadily moving cursor, it flickers into existence occasionally.
That is not a particular issue with the main problem, but I would like to know how to deal with it.
zliyr - they are not necessarily Windows buttons. The apps running in the downloadable app are written by different people and I am trying to write a script that will cope with whatever is thrown at it. The clickable areas could be rectangles or circles in a graphic. I don't want to have to use WindowSpy and then custom-write a script to deal with each individual scenario.
I'm more used to Macs than Windows PCs, but the colour change must be generated by a mouseover or mousehover event, like mousedown or mouseup events for click. Surely ahk must have a way to simulate these events?
AHKSudent - as I said, I've tried a slow mousemove over X, Y. Not only does it not trigger a colour change in the area of interest, but the cursor does not appear as a steadily moving cursor, it flickers into existence occasionally.
That is not a particular issue with the main problem, but I would like to know how to deal with it.
zliyr - they are not necessarily Windows buttons. The apps running in the downloadable app are written by different people and I am trying to write a script that will cope with whatever is thrown at it. The clickable areas could be rectangles or circles in a graphic. I don't want to have to use WindowSpy and then custom-write a script to deal with each individual scenario.
I'm more used to Macs than Windows PCs, but the colour change must be generated by a mouseover or mousehover event, like mousedown or mouseup events for click. Surely ahk must have a way to simulate these events?
Re: Simulating mouse over, mouse hover
Sigh, I don't know if this is a really difficult question or if there are just too few ahk experts around to point me in the right direction
Re: Simulating mouse over, mouse hover
maybe try "mousemoving" at a moderate pace in a circle a couple of times whilst within the boundaries of the button
maybe there are alternate approaches that dont involve you polling for whether the button is clickable or not, but short of disclosing what program this is for and/or providing screenshots/video, i cant tell you if that would be suitable. But you could instead just click the button and then look for a success or error state. idk
maybe there are alternate approaches that dont involve you polling for whether the button is clickable or not, but short of disclosing what program this is for and/or providing screenshots/video, i cant tell you if that would be suitable. But you could instead just click the button and then look for a success or error state. idk
Re: Simulating mouse over, mouse hover
Thanks swagfag, I have tried moving across the area with code but that doesn't seem to create a colour change in the same way that "physically" moving the cursor does. I can try doing it for longer periods and see if that works.
Trouble is it is not necessarily a formal Windows button, just an area of a graphic that works like a button. What I want to do is count the number of times the "button" has been clicked on while it is active assuming that this will have generated a valid click event.
The only other way I can think to do it is to detect graphic changes on the screen following a click that indicate the click has been successful and that's what I am working on at the moment.
But it can be difficult to distinguish between meaningful graphic changes and irrelevant graphic changes. The difficulty is that I am trying to write a script that can handle an app is hasn't met before.
Trouble is it is not necessarily a formal Windows button, just an area of a graphic that works like a button. What I want to do is count the number of times the "button" has been clicked on while it is active assuming that this will have generated a valid click event.
The only other way I can think to do it is to detect graphic changes on the screen following a click that indicate the click has been successful and that's what I am working on at the moment.
But it can be difficult to distinguish between meaningful graphic changes and irrelevant graphic changes. The difficulty is that I am trying to write a script that can handle an app is hasn't met before.
Who is online
Users browsing this forum: Google [Bot], QrJuicy and 65 guests