[Openmcl-devel] GraphSketcher Anyone? (or: can I write to the clipboard)

Ron Garret ron at flownet.com
Mon Dec 22 19:22:41 UTC 2014

Turns out objc:make-nsstring is a built-in function now, so you can just do this:

(defun write-to-clipboard (string)
  (let ((pb (#/generalPasteboard ns:ns-pasteboard)))
    (#/clearContents pb)
      (#/writeObjects: pb (#/initWithObject:
                           (#/alloc ns:ns-array)
                           (objc:make-nsstring string))))))

On Dec 22, 2014, at 11:14 AM, Ron Garret <ron at flownet.com> wrote:

> Try this:
> (defun write-to-clipboard (string)
>   (let* ((pb (#/generalPasteboard ns:ns-pasteboard))
>          (nsstr (with-encoded-cstrs :utf-8 ((s string))
>                   (#/stringWithUTF8String: ns:ns-string s)))
>          (objects (#/initWithObject: (#/alloc ns:ns-array) nsstr)))
>     (#/clearContents pb)
>     (#/writeObjects: pb objects)))
> Notes:
> 1.  This probably leaks memory.
> 2.  You’re supposed to be able to write (make-instance ’ns:ns-array :with-object nsstr) instead of (#/initWithObject: (#/alloc ns:ns-array) nsstr) but it doesn’t work.  I’m pretty sure this is a CCL bug.  I’ve filed a ticket.
> On Dec 21, 2014, at 9:15 AM, Steven Núñez <sales at illation.com> wrote:
>> Has anyone out there had an opportunity to integrate or drive the recently open-source Omni GraphSketcher application from CCL? I’m brushing up on my statistics and find that while GraphSketcher does an adequate job of displaying plots while doing experiments, its method of handling data imports is a bit clumsy. You have to copy & paste data into it, which typically means a workflow of: generate CSV file -> open CSV file -> copy data -> go to GraphSketcher -> paste data
>> This should be easier. Even being able to drag a data file would be simpler, but sadly that’s not available in GraphSketcher. I thought about modifying GraphSketcher, but ObjectiveC/Xcode/Coding Signing path seems too steep to justify the return, and I want to see if there a way to get at this application from the CCL side.
>> One of the quickest ways I suppose would be to write my output data directly to the clipboard, so that I then need just go to GraphSketcher and paste it. Does anyone have any examples of this in CCL? Something like (with-clipboard …) analogous to the (with-open-file …) macro would be a handy thing to have.
>> Regards,
>> - Steve
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20141222/e7cfcb51/attachment.html>

More information about the Openmcl-devel mailing list