Re: copying text to the system clipboard [message #42649] |
Sun, 20 February 2005 13:23 |
Ken Mankoff
Messages: 158 Registered: February 2000
|
Senior Member |
|
|
On Mon, 21 Feb 2005, Mark Hadfield wrote:
> Benjamin Hornberger wrote:
>> is it possible to copy text from an IDL variable to the system
>> clipboard? Specifically, I would like to copy a string array into
>> a multi-line text which can be pasted into Notepad or wherever.
>>
>> I found David's 'clipboard' routine, which does it for graphics
>> windows.
>
> I think your best bet is to write your string array to a temporary
> file, then open that file in your text editor with a call to
> SPAWN. From there you can copy and paste to your heart's content.
Yes on OS X. Use the pbcopy & pbpaste system utilities. You can
either open a pipe and write directly to them, or write to a tmp
file as suggested above and then spawn another command
piping/cat-ing the tmp file to pbcopy.
I would guess Linux has similar command line interface to the
clipboard. I don't know about Win.
-k.
|
|
|
Re: copying text to the system clipboard [message #42650 is a reply to message #42649] |
Sun, 20 February 2005 12:49  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
Benjamin Hornberger wrote:
> is it possible to copy text from an IDL variable to the system
> clipboard? Specifically, I would like to copy a string array into a
> multi-line text which can be pasted into Notepad or wherever.
>
> I found David's 'clipboard' routine, which does it for graphics windows.
To the best of my knowledge there is no way to copy text to the
clipboard directly from an IDL program. (Obviously the IDLDE command
line and console window can communicate with the clipboard, but these
can't be accessed from a program.)
Over the years, I have employed helper applications written in other
programming languages for this purpose. My first one, as I recall,
involved a helper application written in Visual Basic with data
transferred by DDE. But that was a long time ago...
I think your best bet is to write your string array to a temporary file,
then open that file in your text editor with a call to SPAWN. From there
you can copy and paste to your heart's content.
I have some code lying around that does this. It's not robust or
verstile enough for general release, but I could send you a copy. But
it's not too hard to write your own...
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|