Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Positioning the Mouse

Keywords: mousemove mouseclick 

Question:

How do I click at a specific place on my window?

Answer:

First you do a "MouseMove" so that the mouse is directly over the icon. Then you do a "MouseClick".

If the icon is not in the same place all the time, you can do a "MouseMove" to the first icon position and then use the "MouseInfo" function to see what window the mouse is over. If it is not the correct one, move the mouse a little and try again.

Note: Do not move the mouse around or type on the keyboard while script is running, since it won't hold the coordinates and the script won't work if you do so. The keyboard pressing and mouse moving emulates the user.

Run the following script a few times till it looks like the mouse is in the right place. Change x and y as needed.

x=200
y=950
MouseMove(x,y,"","")
Message("Is mouse in the right place","x=%x%    y=%y%")
In general, WinBatch doesn't use the mouse to automate scripts. You should use keystrokes.

Here's a script to track the mouse coordinates:


	Message("Mouse Tracker","This selection shows current mouse co-ordinates")
	BoxOpen("Mouse Tracker","")
	while 1
	   a=MouseInfo(2)
	   BoxText(strcat("Mouse co-ordinates = ",a,@crlf,@crlf,"Hold shift key down to exit"))
	   TimeDelay(0.5)
	   If IsKeyDown(@shift) then break
	end while
	return


Article ID:   W13299
Filename:   Position the Mouse.txt