in reply to Re: how do I place text into clipboard on Linux?
in thread how do I place text into clipboard on Linux?

This probably not exatly what I want

by "Perl to help me with clipboard" I meant that I copied something into clipboard elsewhere (not in my application), then run my one-liner and have in my clipboard something else.

Say, I start Mozilla, make a selection, and then in menu item "Edit->Copy" place a selection into clipboard.

Can I write a one-liner to, say, upcase contents of clipboard, when I paste it elsewhere, I will see upcased content of selection in that Mozilla, which could be un-selected to the moment already?

Also, it must work without X11 also.

In win32 I do this as: perl -MWin32::Clipboard -we "$clip=Win32::Clipboard;$clip->Set(uc($clip->Get())"
my last example is lenghty, but I have wrappers so my actual one-liner is much shorter.

Replies are listed 'Best First'.
Re^3: how do I place text into clipboard on Linux?
by tlm (Prior) on May 02, 2005 at 09:45 UTC

    I have no experience with this very problem, but I would look into the docs for Tk::selection and Tk::Clipboard.

    the lowliest monk

Re^3: how do I place text into clipboard on Linux?
by chanio (Priest) on Aug 02, 2005 at 05:35 UTC
    Tk::Clipboard is included in Linux's Tk.

    Use it like this (very simple)...

    use Tk::Clipboard; my $mw = MainWindow->new(); ... ## after having what you want to copy... $mw->clipboardClear; ## prepare the clipboard (ne +w entry) $mw->clipboardAppend($selected_list); ## copy it (see perldoc)
    Please, read the perldoc for more types of data that could be added to the clipboard. It defaults to strings.

    If you don't use clipboardClear before the second or successive copies, it concatenates what you copy...

    { \ ( ' v ' ) / }
    ( \ _ / ) _ _ _ _ ` ( ) ' _ _ _ _
    ( = ( ^ Y ^ ) = ( _ _ ^ ^ ^ ^
    _ _ _ _ \ _ ( m _ _ _ m ) _ _ _ _ _ _ _ _ _ ) c h i a n o , a l b e r t o
    Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established