Definitions:
Sure, I have plenty of OLE examples, what were you hoping to see?
Word
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Word';
$Win32::OLE::Warn = 2; # Throw Errors, I'll catch them
my $Word = Win32::OLE->GetActiveObject('Word.Application')
|| Win32::OLE->new('Word.Application', 'Quit');
$Word->{'Visible'} = 1;
$Word->Documents->Add || die("Unable to create document ", Win32::OLE-
+>LastError());
my $MyRange = $Word->ActiveDocument->Content;
my $mytxt = "Some Random Text"; # I'll fill this in later
# add a table that is the header portion, 1 column by 1 row
$Word->ActiveDocument->Tables->Add({
Range => $MyRange,
NumRows => 1,
NumColumns => 1,
});
$Word->Selection->TypeText ({ Text => $mytxt});
$Word->Selection->MoveRight({Count => 1});
$Word->Selection->TypeText ({ Text => "A little more text"});
PowerPoint
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft PowerPoint';
$Win32::OLE::Warn = 2; # Throw Errors, I'll catch them
my $PptApp = Win32::OLE->GetActiveObject('PowerPoint.Application')||
+Win32::OLE->new('PowerPoint.Application', 'Quit');
$PptApp->{Visible} = 1;
my $Presentation = $PptApp->Presentations->Add();
#my $Presentation = $PptApp->Presentations->Open({FileName=>'<SOMEFILE
+NAME>',ReadOnly=>1});
my $Slide = $Presentation->Slides->Add({Index=>1 , Layout=>ppLayoutTex
+t});
$Slide->{Name} = "Slide1";
my $TextBox=$Slide->Shapes->AddTextbox({Orientation=>1,
Left=>5,
Top=>5,
Width=>250,
Height=>250,});
$TextBox->TextFrame->TextRange->{Text} ="Big Ole Test";
my $Title=$Slide->Shapes->{Title};
$Title->TextFrame->TextRange->{Text} ="Title Test";
my $NewSlide = $Slide->Duplicate();
$NewSlide->{Name} = "Slide2";
OutLook
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Outlook';
$|++;
$Win32::OLE::Warn = 2; # Throw Errors, I'll catch them
my $OL = Win32::OLE->GetActiveObject('Outlook.Application')
|| Win32::OLE->new('Outlook.Application', 'Quit');
my $NameSpace = $OL->GetNameSpace("MAPI");
my $Folder = $NameSpace->GetDefaultFolder(olFolderInbox);
# map {print "Attachment Name: ". $_->Attachment(1)->{Name} ."\n";}
+(in ($Folder->{Items}));
foreach my $msg (in $Folder->{Items}){
foreach my $atch (in $msg->{Attachments}){
my $filename = "C:\\atchs\\" . $atch->{FileName};
#print $atch->{FileName} ." in message ". $msg->{Subject} .
+"\n";
print $filename ."\n";#." in message ". $msg->{Subject} ."\
+n";
$atch->SaveAsFile($filename);
}
}
I mean, really, what are you hoping to accomplish? Did you have a task in mind? You'll need to use an object browser, something like Active States html based one, or MS various tools. C-. Update: Added defn links |