A little question about saving keynote presentation

Hello,

I have one little question. The question is how I can save the current presentation of Keynote with a specified filename. For example the filename is defined in the Applescript like a variable called “filename”.
I think this is a little code but I can’t find something on the internet that is working good.

Karsten,

Hi karsten,

The following code works fine on my Mac with Keynote 08:


set filepath to (((path to desktop) as Unicode text) & "Sample.key")

tell application "Keynote"
	save slideshow 1 in filepath
end tell

P.S.: You can simply drag and drop Keynote’s icon onto the Script Editor’s icon to view Keynote’s complete AppleScript dictionary.

Thanks Martin for the script and the good thip!

But the script is actually not working, i’ve got the error that he expected the end of the line but found a number (the 1).
If I remove the one he can compile of course but he is getting a problem when he needs to execute this piece of code because the presentation that has been saved is not defined.

Hi karsten,

I guess you have modified my script and entered your slideshow reference. Then this error happens:


set filepath to (((path to desktop) as Unicode text) & "Sample.key")

tell application "Keynote"
	set myslideshow to slideshow 1
	save myslideshow 1 in filepath
end tell

Of course, this throws an error. Instead you must use code as follows:


set filepath to (((path to desktop) as Unicode text) & "Sample.key")

tell application "Keynote"
	set myslideshow to slideshow 1
	save myslideshow in filepath
end tell

This might be the problem :wink:

Thanks, the problem is solved now!