Document path in Keynote

After creating a new Keynote document, I would like to specify its name. How?

The ‘document name’ in keynote is read only and seems to be a reflection of the file name, so rename it in the Finder.

tell application "Keynote"
	-- get the file property of the open document
	set keyPath to file of document 1
    -- while the `file` property looks like a typical file specifier, it isn't really and doesn't work outside of keynote so coerce to text	
    set keyPath to file of thisDocument as text
end tell

tell application "Finder" to set name of file keyPath to "crap2.key"

The name change should take place immediately and does not require that the document be closed first.

I should note that I’m running keynote 8.1 so maybe they’ve improved things since its release.

They sure have. I was running 9 and now 10. In 9, I couldn’t set the X coordinate of an image with Applescriot and now I can. Thanks for the answer. I haven’t scripted any file system stuff, so I have some learning to do.

When you make new document you get a default name. To change that we need to save the document somewhere. So the simple approach would be to use 2 line of code in tell block of keynote.


tell application "Keynote"
	set myDoc to make new document
	save myDoc in file ((path to desktop as text) & "myDocName.key")
end tell