Hi,
My two cents:
I'm afraid that for such ambitious task, grread is too primitive a tool.
Most probably it will take something like .NET and some Windows API
function(s) in order to control the mouse the way you want it.
Regards
--
Humans are born with a wide horizon.
As time goes by, the horizon narrows and
narrows, until it becomes a point of view.
a écrit dans le message de news:
6271274@discussion.autodesk.com...
Using Autolisp I want to write code which differentiates between the
still and moving state of mouse. I have written a number of test codes to
do the task. One of them is given below, I have used the grread function.
So far I am not able to achieve the goal. In the following program I have
tried to display state of mouse on command line, i.e. if it is moving or
still.
But even if I continueusly move the mouse the output of the program is like
this
mouse is moving
mouse is still
mouse is moving
mouse is still
..
..
..
..
Which I do not understand why, if the mouse is continueusly moving the
program
should only display mouse is moving and not the other message. Please guide.
(defun c:tst()
(setq coor nil) ; To store coordinates returned by grread.
(setq code nil) ; To store the integer code returned by grread.
(while(/= code 3)
(setq input(grread t))
(setq code(car input))
; If input is being read for first time.
(if(= nil coor)
(progn
(setq coor(cadr input))
)
(progn
(setq newCoor(cadr input))
(if(equal newCoor coor)
(progn
(princ "mouse is still\n")
)
(progn
(princ "mouse is moving\n")
(setq coor newCoor)
)
)
)
)
)
)
Secondly, according to help of grread we can pass a number of arguments. I
want to use grread such that it works only
when I move the mouse or If I press a keyboard key. is it possible to do
that if so what arguments values we need to pass it.
I think if we use (grread T) it returns the cursor coordinates with return
code 5 even if we do not move mouse.