Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Applescript to perform multiple find-replace to PowerPoint presentation

Featured Replies

Hi,

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

------------

tell application "Microsoft PowerPoint"

       activate

       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,

Daniel

What does this have to do with Filemaker?

 

  • Author

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.

I don't see any interaction with Filemaker in your script. Is that your question? How to pass data from Filemaker to the AppleScript?

 

  • Author

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.

Is that a yes to my question? I can't figure out what this is about. 

  • Author

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.