Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Clipboard 1

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
I m looking for a way to store a scalar variable (text) into the windows clipboard. Does anybody know how that works?

THX!!!!!
 
from the Perl documentation:

Win32::Clipboard - Interaction with the Windows clipboard

SYNOPSIS
use Win32::Clipboard;
$CLIP = Win32::Clipboard();
print "Clipboard contains: ", $CLIP->Get(), "\n";
$CLIP->Set("some text to copy into the clipboard");
$CLIP->Empty();
$CLIP->WaitForChange();
print "Clipboard has changed!\n";


--------------------------------------------------------------------------------

DESCRIPTION
This module lets you interact with the Windows clipboard: you can get its content, set it, empty it, or let your script sleep until it changes. This version supports 3 formats for clipboard data:

text (CF_TEXT)
The clipboard contains some text; this is the only format you can use to set clipboard data; you get it as a single string.
Example:

$text = Win32::Clipboard::GetText();
print $text;

bitmap (CF_DIB)
The clipboard contains an image, either a bitmap or a picture copied in the clipboard from a graphic application. The data you get is a binary buffer ready to be written to a bitmap (BMP format) file.
Example:

$image = Win32::Clipboard::GetBitmap();
open BITMAP, ">some.bmp";
binmode BITMAP;
print BITMAP $image;
close BITMAP;

list of files (CF_HDROP)
The clipboard contains files copied or cutted from an Explorer-like application; you get a list of filenames.
Example:

@files = Win32::Clipboard::GetFiles();
print join("\n", @files);

Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Yeah, I red this one, but I cant figure out what is ment with it. I got it work the way that I had my Clipboard in an variable, but not the other way round like I need it.
But thx!!
 
You mean that:

use Win32::Clipboard;
$CLIP = Win32::Clipboard();
$CLIP->Set("some text to copy into the clipboard");

didn't work for you? Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Cool Mike, that may come in useful sometime. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Yeah it's neat isn't it - wish it were *my* module... Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top