To open your PowerPoint presentation in Safe Mode using an AutoHotkey (AHK) script, you'll need to launch PowerPoint with the /safe switch and pass your .pptx file as a parameter. This ensures that PowerPoint starts in Safe Mode, which disables add-ins and certain features that might be causing issues.
Here's how you can modify your AHK script to achieve this:
-
Find the Path to POWERPNT.EXE:
First, you need to locate the POWERPNT.EXE executable on your system. It's typically found in one of the following directories, depending on your Office version:
- Office 365 / Office 2019 / Office 2021:
C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE
- Office 2016:
C:\Program Files\Microsoft Office\Office16\POWERPNT.EXE
- Office 2013:
C:\Program Files\Microsoft Office\Office15\POWERPNT.EXE
- 32-bit Office on 64-bit Windows:
C:\Program Files (x86)\Microsoft Office\root\Office16\POWERPNT.EXE
Note: Adjust the path according to your installed Office version and architecture.
-
Modify Your AHK Script:
Replace your existing Run command with the following, ensuring you update the path to POWERPNT.EXE as needed:
; Define the path to POWERPNT.EXE
powerPointPath := "C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE" ; Update this path
; Define the path to your PowerPoint file
pptxPath := "C:\Users\Global Display\Desktop\climatechange-videoplayer-win32-x64\climatechange-videoplayer-win32-x64\resources\app\src\assets\Climate Change Station V2.pptx"
; Run PowerPoint in Safe Mode with the specified presentation
Run, "%powerPointPath%" /safe "%pptxPath%"
Explanation:
powerPointPath stores the path to the PowerPoint executable.
pptxPath stores the path to your .pptx file.
- The
Run command launches PowerPoint with the /safe switch, opening your presentation in Safe Mode.
-
Complete AHK Script Example:
Here's the complete AHK script incorporating the changes:
; Define the path to POWERPNT.EXE
powerPointPath := "C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE" ; Update this path as necessary
; Define the path to your PowerPoint file
pptxPath := "C:\Users\Global Display\Desktop\climatechange-videoplayer-win32-x64\climatechange-videoplayer-win32-x64\resources\app\src\assets\Climate Change Station V2.pptx"
; Check if PowerPoint executable exists
if !FileExist(powerPointPath)
{
MsgBox, PowerPoint executable not found at:`n%powerPointPath%
ExitApp
}
; Check if the PowerPoint file exists
if !FileExist(pptxPath)
{
MsgBox, PowerPoint file not found at:`n%pptxPath%
ExitApp
}
; Run PowerPoint in Safe Mode with the specified presentation
Run, "%powerPointPath%" /safe "%pptxPath%"
; Optional: Exit the script after running
ExitApp
-
Run the AHK Script:
- Save the script with a
.ahk extension, for example, OpenPPTInSafeMode.ahk.
- Double-click the script to execute it. PowerPoint should open your specified presentation in Safe Mode.
-
Troubleshooting Tips:
- Incorrect Path: Ensure that the paths to both
POWERPNT.EXE and your .pptx file are correct. You can verify the PowerPoint path by searching for POWERPNT.EXE in File Explorer.
- Permissions: Make sure you have the necessary permissions to execute
POWERPNT.EXE and access the .pptx file.
- Quotes Handling: Ensure that paths with spaces are enclosed in quotes (
"). This prevents issues with spaces in directory or file names.
By following these steps, your PowerPoint presentation should open in Safe Mode through the AHK script, allowing you to troubleshoot or present without the interference of add-ins or other potential issues.