Jump to content

Applescript to perform multiple find-replace to PowerPoint presentation

Recommended Posts


Piecing bits from other posts I've cobbled something that looks promising:


tell application "Microsoft PowerPoint"


       repeat with slideNumber from 1 to count of slides of active presentation

           tell slide slideNumber of active presentation

               repeat with shapeNumber from 1 to count of shapes

                   set shapeText to content of text range of text frame of shape shapeNumber

set selFind to get find object of selection

clear formatting selFind

set highlight to false

set forward to true

set format to true

                   set newText to my replaceText(shapeText, findText, replaceText)

                   if newText ≠ shapeText then

                       set content of text range of text frame of shape shapeNumber to newText

                   end if

               end repeat

           end tell

       end repeat

   end tell

on replaceText(theText as text, findString as text, replaceString as text)

   set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, findString}

   set textItems to text items of theText

   set AppleScript's text item delimiters to replaceString

   set theResult to textItems as text

   set AppleScript's text item delimiters to oTIDs

   return theResult

end replaceText


The script order is probably off and certainly some lines are unnecessary. Anyone care to pitch in?

All the very best,


Link to post
Share on other sites

I have two fields in FileMaker, one with the find text and the other with the replace text, plus some formatting conditions (highlight, forward, format). Filemaker contains a database with the find-replace pairs. So, instead of performing find-replace within Powerpoint by hand, I run the replacements from Filemaker.

Link to post
Share on other sites

The Filemaker file has two fields, one for 'find' and one for 'replace with'.

I have a button which calls the script that should recognize that a powerpoint file is open and perform replacements within the entire file.

I made one for replacing text within Word documents but it doesn't work the same because of the shapeName and shapeText variables.

Link to post
Share on other sites

Filemaker should interact with PowerPoint via an Applescript, invoked on Button click.  The script should select each record within Filemaker and perform a find-replace until all the records have been processed.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.