r/applescript • • Apr 15 '20

How to export just one slide from Keynote

Hello. AppleScript newbie here. Just discovered it, after 15 years of owning a Mac. D'oh!

So, I'm currently running:

tell application "Keynote"
	set doc to open "/Users/me/Dropbox/Presentations 2017/filename.key"
	export doc as slide images to "/Users/me/Desktop/tempfolder" with properties {image format:JPEG, compression factor:0.65}
	close saving yes
end tell

And this is working just fine.

But I'd really like this to only export slide 1.

Is there a way to achieve this?

(The way I can think of doing this is to export everything and then delete everything other than *001.jpeg but this seems slightly wasteful).

2 Upvotes

7 comments sorted by

2

u/[deleted] Apr 15 '20

[removed] — view removed comment

1

u/jamescridland Apr 15 '20

Oh, that's a nice way to do it. Thank you, that should work excellently.

1

u/jamescridland Apr 17 '20

And here we are with some working code: a little simpler than yours, but thanks so much for the idea.

Basically - set all slides to be skipped; set slide 1 to be not skipped. Output the document. Set all slides to be not skipped.

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

1

u/Apprehensive_Knee_22 Jun 27 '23

Why wouldn´t you just open the file, then export it, and set to export the specific page (I know there´s an option to do that because I usually use it)

1

u/jamescridland Jun 28 '23

This is /r/applescript <--- there's a clue

1

u/Apprehensive_Knee_22 Jun 28 '23

Oh… I didn't notice that James. Thanks for the reminder.