#Include #include #include #include #include Global $listing Global $Total_Files $directory = FileSelectFolder("Choose Folder to Search for Powerpoint Files", "") if @error then Exit list($directory, 0) $listing = StringTrimRight($listing, 1) $listing = _StringExplode($listing, "|", 0) _ArraySort($listing) MsgBox($MB_SYSTEMMODAL, "CONVERSION", " " & $Total_Files & " PowerPoint Files Found" & @CRLF & " Press OK To Begin") For $iCount = 0 To $Total_Files - 1 File_Converter($listing[$iCount]) Next ;This Function builds a List of all the files to be converted including sub directories Func list($path = "", $counter = 0) $counter = 0 $path &= '\' Local $Check_File_Type Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*') If $demand_file = -1 Then Return '' While 1 $file = FileFindNextFile($demand_file) If @error Then ExitLoop If @extended Then If $counter >= 10 Then ContinueLoop list($path & $file, $counter + 1) Else $Check_File_Type = StringRight($file,5) if ($Check_File_Type = ".pptx") Then $Total_Files = $Total_Files + 1 $listing &= $path & $file & "|" Endif EndIf WEnd FileClose($demand_file) EndFunc ;This Function Converts the Files from 4x3 to 16x9 and resizes the image in the file Func File_Converter($File_Name) ; Set a variable to represent the 16x9 format Local Const $PpSlideSizeOnScreen16x9 = 15 local $New_File_Name = $File_Name ;Create a Powerpoint object Local $oPPT = _PPT_Open() ;Set a variable with the file path and name to be opened Local $sPresentation = "C:\PowerPoint Converter\4by3.pptx" Local $sPresentation = $File_Name ;Open up the Powerpoint file Local $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True) if @error then ConsoleWrite ("Failed to Open Presentation"& @CRLF ) ;Change the powerpoint to a 16 x 9 format $oPresentation.PageSetup.SlideSize = $PpSlideSizeOnScreen16x9 ;Loop thtough all images and adjust them to the full screen size Local $curSlide, $curShape For $curSlide In $oPPT.ActivePresentation.Slides For $curShape In $curSlide.Shapes With $curShape .LockAspectRatio = False .ScaleHeight(3.38, True) .ScaleWidth(5.13, True) .Rotation = 0 .Left = 0 .Top = 0 EndWith Next ; curShape Next ; curSlide ;Parse new File Name $New_File_Name = StringTrimRight($New_File_Name, 5) ;Save the Powerpoint with a new filename $New_File_Name = $New_File_Name & "(16x9).pptx" _PPT_PresentationSaveAs($oPresentation, $New_File_Name,$ppSaveAsPresentation, True) if @error then ConsoleWrite ("Failed to SaveAs Presentation"& @CRLF ) ;Close the new Powerpoint file _PPT_PresentationClose($oPresentation) if @error then ConsoleWrite ("Failed to Close Presentation"& @CRLF ) ;Close the Powerpoint program _PPT_Close($oPPT) EndFunc