[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Paste Not Working with Build Application (MACL 1.3.2/System 7)

    I'm trying to prototype a new type of functionality by linking
together Excel and a Lisp program.  As a first cut, I'd like to be
able to write a Lisp program that reads the clipboard, processes the
data, and then pastes the results back into the clipboard.  When run
from within the Lisp interpreter, the code below does that just fine,
but when I compile it for a stand-alone application, it reads the
clipboard but doesn't paste its result.

    Anybody tried to interact with the clipboard before?  Any ideas
what I'm doing wrong?

; Source:  Macintosh Allegro Common Lisp 1.3.2 / System 7 / Mac IIfx
; Created: 24 October 1991
; Author:  Jeff Schlimmer (schlimmer@eecs.wsu.edu)

; The following code is supposed to read the clipboard contents, count
; the number of characters, and put that number back on the clipboard.

(defun count-clipboard ()
  (put-scrap :text (princ-to-string (length (get-scrap :text))))
  (%set-toplevel nil)

(defun make-count-clipboard ()
  (let ((target (choose-new-file-dialog
		 :prompt "Save count clipboard as ...")))
    (set-menubar nil)
    (save-application target
                      :compress nil
                      :toplevel-function #'count-clipboard)))