lisp code to Get Cursor Position

lisp code to Get Cursor Position

GeryKnee
Advocate Advocate
388 Views
2 Replies
Message 1 of 3

lisp code to Get Cursor Position

GeryKnee
Advocate
Advocate

 

Ηello everyone.

the following returns the currnt Cursor position


(defun fnCursorPoint ( / result)
(while(not(setq result (cadr (grread T 0 0))))
(setq result nil))
result
)

But if there is no mouse movement. it does not return, running inside the while loop, as grread waits for an event to be released from llop and return the cursor position.
I need if possible (if autolisp supports it), using autolisp another code that will return the current cursor position.

Thanks,

Gery.

0 Likes
389 Views
2 Replies
Replies (2)
Message 2 of 3

paullimapa
Mentor
Mentor

Not sure it can be done in lisp without cursor movement but check out Lee Macs version

https://www.lee-mac.com/grtext.html


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 3

komondormrex
Mentor
Mentor

@GeryKnee 

hey,

check the following

(while t (print (cadr (grread t 1 0))))

move cursor or not, left click to get cursor coordinates.

(defun fncursorpoint (/ grread_data)
	(while (not (= 3 (car (setq grread_data (grread t 1 0))))))
  	(cadr grread_data)
)