Skip to content

numpyb/GeneratePPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

GeneratePPT - PowerShell Script for Automating PowerPoint Image Insertion

📌 Overview

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.

✨ Features

  • ✅ 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.

🔧 Requirements

  • 🖥️ 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.

📥 Installation

  1. Ensure PowerPoint is installed on your system.
  2. Save the script file as GeneratePPT.ps1.
  3. 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.

🚀 Usage

  1. Place your PowerPoint template in the specified location.
  2. Store the images you want to insert in the designated folder.
  3. Run the PowerShell script:
    .\GeneratePPT.ps1
  4. The script will process the images, insert them into the slides, and save the final presentation at the specified output location.
  5. A confirmation message box will appear upon successful completion.

⚙️ Configuration

  • Modify the $Left, $Top, $Width, and $Height variables in the script to adjust image positioning and size on the slides.
  • Change the $PowerPoint.Visible value to 0 if you want to run the script in a hidden PowerPoint session.

🛠️ Error Handling

  • ❌ 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.

📌 Example

If you have a template with 40 slides and 4 images in C:\Users\brbal\New\new-images, running the script will:

  1. Open the template.
  2. Skip the first slide.
  3. Insert each image onto a new slide.
  4. Save the modified presentation as C:\Users\brbal\New\Newoutput.ppt.
  5. Display a success message.

🧑‍💻 Author

Billy R Baldwin
📅 January 28, 2025

About

This powershell script will generate a ppt file from a directory of images, and insert the images.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors