Ishan Arora wrote:
Hi,
Is there a procedure to get mouse position.
I guess there may be a way via X11, but it is not clear to me. What you
might want to be doing is knowing the coordinates of a click in a
canvas, which is not the same thing (and easier).
And is there a procedure to synchronously run a shell code and return
the output as a String. Thanks.
;; code from thi <ttn at mingle.glug.org>
;;
;; run command and put the output into a string and return
;; it. (c.f. @code{run-command/strings})
(define (shell-command-to-string cmd)
(with-output-to-string
(lambda ()
(let ((in-port (open-input-pipe cmd)))
(let loop ((line (read-line in-port 'concat)))
(or (eof-object? line)
(begin
(display line)
(loop (read-line in-port 'concat)))))))))
Paul.