GeneratePPT is a PowerShell script designed to automate the process of adding images to an existing PowerPoint template file. This is particularly useful for generating look-books, presentations, or any document requiring consistent image placement. The script skips the first slide and inserts images onto the subsequent slides, ensuring that the number of slides matches the number of images.
- ✅ Automatically inserts images into an existing PowerPoint template.
- ✅ Skips the first slide (assumed to be a title slide).
- ✅ Supports JPG, JPEG, and PNG image formats.
- ✅ Creates additional slides dynamically if the number of images exceeds the template's available slides.
- ✅ Displays progress and error messages via console output and message boxes.
- 🖥️ Windows operating system with Microsoft PowerPoint installed.
- ⚡ PowerShell with COM object support enabled.
- 📂 A PowerPoint template file (
.pptx). - 🖼️ A folder containing the images to be inserted.
- Ensure PowerPoint is installed on your system.
- Save the script file as
GeneratePPT.ps1. - Update the script variables to match your file paths:
$TemplatePath- Path to the PowerPoint template file.$OutputPath- Path where the new PowerPoint file will be saved.$ImageFolder- Folder containing the images.
- Place your PowerPoint template in the specified location.
- Store the images you want to insert in the designated folder.
- Run the PowerShell script:
.\GeneratePPT.ps1
- The script will process the images, insert them into the slides, and save the final presentation at the specified output location.
- A confirmation message box will appear upon successful completion.
- Modify the
$Left,$Top,$Width, and$Heightvariables in the script to adjust image positioning and size on the slides. - Change the
$PowerPoint.Visiblevalue to0if you want to run the script in a hidden PowerPoint session.
- ❌ If the template file is missing, the script will throw an error.
- ❌ If an image file is missing, it will be logged in the console output.
- ❌ If more images exist than slides, the script dynamically adds slides.
If you have a template with 40 slides and 4 images in C:\Users\brbal\New\new-images, running the script will:
- Open the template.
- Skip the first slide.
- Insert each image onto a new slide.
- Save the modified presentation as
C:\Users\brbal\New\Newoutput.ppt. - Display a success message.
Billy R Baldwin
📅 January 28, 2025