in reply to Win32::OLE Examples?
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"});
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";
I mean, really, what are you hoping to accomplish? Did you have a task in mind?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); } }
You'll need to use an object browser, something like Active States html based one, or MS various tools.
C-.
Update: Added defn links
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Win32::OLE Examples?
by Flame (Deacon) on Mar 20, 2002 at 22:13 UTC | |
by cacharbe (Curate) on Mar 21, 2002 at 04:44 UTC | |
by Flame (Deacon) on Mar 21, 2002 at 17:45 UTC | |
by cacharbe (Curate) on Mar 21, 2002 at 18:13 UTC | |
|
Re^2: Win32::OLE Examples?
by ewittry (Initiate) on Jan 10, 2008 at 22:16 UTC |