This project is read-only.

mouse click fails

Apr 7, 2010 at 7:11 PM

I'm using white to drive an old GUI for which I don't have the source.  Most things seem to work ok, but there are some arrow buttons that can't be found in UI Spy, so I've been using the AttachedMouse to click where the buttons are located.  I can also see a text field that shows a side effect when the button is pressed, so I know when the result worked.

I am finding that most time I call click, the button is not pressed.  To partially deal with this, I do something like...

AttachedMouse mouse = window.Mouse;
TextBox textBox = (TextBox) window.Get("result");

Point pt = new Point(x, y);

while(textBox.Text != "success")

While this usually works, sometimes the button never changes.  It always works when I click it myself.  I'm not quite sure what might cause this (perhaps the mouse needs to be held in the clicked position longer?).  Any suggestions about how to work around something like this?


Apr 11, 2010 at 5:36 AM

can you try changing the source code of white and try keeping the mouse pressed for bit longer and see if that solves the problem. if it does then I can add this feature to white code.


Apr 11, 2010 at 6:14 AM

I didn't change the white source, but I did write a function to do it myself and it worked fine... I based my call on this post, but with the following modification...


mouse_event(MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, X, Y, 0, 0);

I actually didn't test without the sleep put in there, but it works every time now.  I'll take a look at it Monday to see if it made a difference.


Apr 12, 2010 at 7:58 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.