accessing clipboard/pasteboard

Skip to first unread message


Jun 2, 2013, 11:34:00 AM6/2/13

I have to work with the clipboard (windows, linux), and pasteboard on mac.

Anyone have any examples of working with these with jsdb?

Suggestions for how to do it?

I guess linux - figure out if I am in X or terminal mode (other modes?) run xclip or gpm using execute?

Do similar for clipboard in windows.

execute for pbcopy in mac.

Does this seem right or wrong headed? Smarter way to do it?

Bryan Rasmussen

Shanti Rao

Jun 3, 2013, 12:46:34 AM6/3/13
Hi Bryan,

The sensible thing would be to have functions like system.clipboardCopy() and system.clipboardPaste(). If you can find some code snippets for copying/pasting UCS-2 or UTF-8 text, I'll add them. (I finally fixed my GCC problem, so an update to JSDB is in the works).


bryan rasmussen

Jun 3, 2013, 4:18:45 AM6/3/13
That would change between systems, and also how low level you wanted it?

For example if it was linux then it would be different depending on what gui you had, and also different for the terminal (depending on how hacky you wanted to do it)

for example if you have X then you use xclip, in the terminal you might use gpm, etc. etc.

On mac you would use pasteboard NSPasteboard,

on windows I can't recall at the moment but it's not that important because windows working with the clipboard is the easiest.

But this is all based on doing it the 'right' way, which I was thinking to do it the hacky way, that is to do a execute to get clipboard info and then just branch on what I had to execute based on OS.

The reason why I would prefer this is I don't actually see any difference in the result for my usecase, which is to get text If I am wanting to access smart clipboard content, like fragments of html it would have to be pretty complicated.

The hacky way is what node-copy-past does although it gets extra hacky by using a vbscript to access the windows clipboard and pipe it back.

You received this message because you are subscribed to the Google Groups "JSDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages