Hi ciryon,

Your question is a little ambiguous (could be read several ways) so I'll reply the best I can and if I am off base you can let me know in a reply.

There are two different ways right off the top I would address your question. The first is handling your exact example. Netscape (Mozilla) definitely provides you an option to supply it an URL on the command line (even if it is already running) and displaying that URL in the browser. There are a number of options that the script used to launch the application provides.

The more complicated issue (and probably more directly related to your question) is manipulating the clipboard from within a Perl application. All my experience is with Perl/Tk so I cannot directly address Perl/GTK or wxPerl (which I'm dying to learn because I understand is the GUI of choice for Perl these days). From Perl/Tk there is a Tk::clipboard module that provides you direct access to the clipboard through the $widget->clipboardClear and $widget->clipboardAppend methods. This would enable you to load the clipboard (in X and presumably WinXX as well) with pretty much any data you like. From there it would be a manual process to paste that data into your application. That is to say there is method provided by Perl/Tk that allows you force your clipboard into some widget of another application. I also highly doubt that any language would provide for such a method.

The clipboard isn't generally used as a shared memory area where one application can put data for another to automatically pick that information up. It possibly could be treated that way, but it would be very sensitive to user interruption. KDE has a nice applet that tries to intelligently handle information you put in the clipboard and may also provide you with some of the functionality you desire. However this applet performs the action I first discussed - it calls the application with data on the command line.

In summary I don't think what you are asking for is directly possible, but playing with the clipboard using Perl is. The documentation for Perl/Tk is pretty good so if you have it check it out. wxPerl may provide you with additional options I am not aware of.

Good luck!
{NULE}


In reply to Re: 'Paste' data in X by {NULE}
in thread 'Paste' data in X by ciryon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.