use strict; use warnings; use utf8; use Tk; use Try::Tiny; use Win32::OLE; use Win32::OLE::Const qw( Microsoft.PowerPoint ); use Win32::OLE::Enum; my $mw = Tk::MainWindow->new( -width => 160, -height => 120, ); $mw->packPropagate(0); # Button erstellen: my $but = $mw->Button( -text => "Save PPT", -command => \&save_PPT, ); $but->pack(); my $quit_btn = $mw->Button( -text => "Exit", -command => \&quit_program, ); $but->pack(); $quit_btn->pack(); $mw->MainLoop(); sub save_PPT { my $filename = "C:\\Users\\Taka\\Desktop\\original.pptx"; my $ppt; try { $ppt = Win32::OLE->GetActiveObject('PowerPoint.Application') } catch { die $_ } ; unless ( $ppt ) { $ppt = Win32::OLE->new( 'PowerPoint.Application', sub { $_[0]->Quit } ) or return 'error'; } $ppt->{Visible} = 0; my $presentation = $ppt->Presentations->Open($filename, 1); my $slides = Win32::OLE::Enum->new( $presentation->Slides ); $presentation->SaveAs("SAVED_" . $filename); $presentation->Close; $mw->messageBox (-title => "message", -message=>"DONE!", -icon=> 'info'); } sub quit_program { exit(0); }