clipboard

View: New views
3 Messages — Rating Filter:   Alert me  

clipboard

by Bugzilla from harry@saltyshells.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

.... coding well above my pay-grade.... :D

what I am trying to do:

Highlight (select?) some text (from the location bar of firefox, for example)

Launch my app.

Have my app `know` what is in the clipboard so that I can make immediate use
of it (have it populate something if it happens to be a URL).


Issue is that I can't seem to wrap my head around 'clipboard'.

I am not looking for code, per se, but if someone would be kind enough to
tell me what I need to know to get going... I haven't a clue

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: clipboard

by Mario Kemper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
> Issue is that I can't seem to wrap my head around 'clipboard'.
>
> I am not looking for code, per se, but if someone would be kind enough to
> tell me what I need to know to get going... I haven't a clue

Just have a look at the following code:

#! /usr/bin/perl

use strict;
use warnings;
use utf8;

use Gtk2 '-init';

my $clipboard = Gtk2::Clipboard->get( Gtk2::Gdk->SELECTION_CLIPBOARD );

my $clipboard_string = $clipboard->wait_for_text;

if ($clipboard_string){
        print "Content of clipboard is: $clipboard_string\n";
}else{
        print "Content of clipboard is: empty\n";
}



Regards
Mario

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: clipboard

by Bugzilla from harry@saltyshells.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mario,

Thank you for the quick response. I was getting no where with it.
Seems I was grossly over-thinking the problem at hand.

After a trial run, I found that I actually wanted SELECTION_PRIMARY in place
of your suggestion of SELECTION_CLIPBOARD.

Thanks for the help!

Harry_


On Sunday 19 July 2009, Mario Kemper wrote:

> > Issue is that I can't seem to wrap my head around 'clipboard'.
> >
> > I am not looking for code, per se, but if someone would be kind enough to
> > tell me what I need to know to get going... I haven't a clue
>
> Just have a look at the following code:
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
> use utf8;
>
> use Gtk2 '-init';
>
> my $clipboard = Gtk2::Clipboard->get( Gtk2::Gdk->SELECTION_CLIPBOARD );
>
> my $clipboard_string = $clipboard->wait_for_text;
>
> if ($clipboard_string){
> print "Content of clipboard is: $clipboard_string\n";
> }else{
> print "Content of clipboard is: empty\n";
> }
>
>
>
> Regards
> Mario


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list