Export the Current Keynote Slide as a PNG

I use Keynote for creating graphics for various purposes, and I've found myself frustrated by the number of manual steps needed to export a single slide as a PNG image. I was pointed to Keyboard Maestro as a possible solution. What I am trying to do is create an action that will:

  • Get the number of the currently selected slide
  • Open the Export Image menu: File -> Export To -> Images...
  • Choose the "From" option and enter the slide number in both the "From" and "to" fields
  • Choose the "PNG" format
  • Click Next
  • Enter a filename that includes the slide number (otherwise you get a warning about overwriting the last time you exported)
  • Click Export

I can't seem to figure out how to select the specific fields in this export menu, I don't want to do it with cursor position offsets since that seems unreliable. Any help is appreciated!

Use the Select a Menu Item action.

Use the Click Mouse action, to click relative to the found image. The image to choose is a bit uncertain, I'd probably try


but that is small and grey, which is not great for the image match, so maybe use the heading

and a relative coordinate from that.

Use the Type a Keystroke action to Tab in to the field, and then Insert Text by Typing action to type the number, and then another Tab and repeat the number.

Click on the menu. As above, choose either an image like:


or use a click relative to the top banner.

Then the Insert Text by Typing action to type "PNG%Return%".

Use the Type a Keystroke action to type a Return.

Use Insert Text by Typing action to type the desired name, including the %Variable%Slide Number% retrieved as described in the linked post.

Use the Type a Keystroke action to type a Return.

Liberally add Pause actions to allow the previous actions to complete, especially after the menu selection, and after the clicks, and window changes.

1 Like

Hey Aaron,

I think Keynote still supports AppleScript.

Here's an example:

tell application "Keynote"
   set doc to open "/Users/me/Dropbox/Presentations 2017/filename.key"
   tell the front document
      set skipped of every slide to true
      set skipped of slide 1 to false
   end tell
   export doc as slide images to "/Users/me/Desktop/folder" with properties {image format:JPEG, compression factor:0.9}
   tell the front document
      set skipped of every slide to false
   end tell
   close saving yes
end tell

This exports to JPEG instead of PNG, but that should be easy enough to change.

Ask here if you need help: Script Debugger Forum



Thanks, this is amazing! I didn't realize it could do image matching to establish a reference point!

I ended up using a pure AppleScript solution for this, but it requires setting all but the current slide to "skipped" and then setting them all back to "unskipped", whereas this solution would avoid that problem! I will come back to this if that ends up being a problem for me. Thanks!


Keep coming back and you'll have more than a few "This is amazing!" moments.


1 Like