Page 1 of 1

Export headings (TOC) to keynote

Posted: 2017-02-04 11:59:28
by Axbax
Greetings! Does anyone know of a macro or a script that allows exporting the headings of a document to keynote (or perhaps powerpoint) presentations? It would be excellent to be able to create presentations from the outline in Nisus Writer Pro.

Thanks in advance.

Re: Export headings (TOC) to keynote

Posted: 2017-02-06 15:06:59
by adryan
G’day, Kenneth et al

I agree, this could be useful on occasion.

I’m afraid I don’t have time to work on a full solution at present, but after a bit of experimentation I’ve found the crucial AppleScript expressions for inserting text into a Keynote slide. As with so many things with AppleScript, the answers are by no means obvious!

Code: Select all

tell application "Keynote"
	make new document
	tell document 1
		tell slide 1
		-- Quoted strings are sample text.
			set object text of default title item to "My Slide Title"
			set object text of default body item to "My slide contents."
		end tell
	end tell
end tell
The general idea would be to transform your Nisus outline into a list in AppleScript, then add loops to the above rudimentary code to create and populate successive Keynote slides using items from the list.


Re: Export headings (TOC) to keynote

Posted: 2017-02-06 22:19:39
by adryan
G’day, all

It may not be amiss here to alert those new to using AppleScript to link different applications, to the somewhat patchy nature of AppleScript support in the big bad world out there, even amongst Apple’s own products. There is little point in producing the most elegant code for one part of a project, only to encounter subsequently an insurmountable obstacle in another part.

My advice (and practice) is to identify critical steps in a project and attempt to get workable code for these steps, in decreasing order of difficulty. In the current situation, I know that Nisus Writer has very good AppleScript support (particularly with its handy Do Menu Macro command), whereas Keynote’s support was uncertain (ie, I was not sufficiently familiar with it). To my mind, getting text (regardless of source) into a Keynote slide was likely to be the make-or-break step, which is why I tried to solve that problem first. Just as well, as the AppleScript dictionary for Keynote is insufficiently explicit in showing the way.

There may well be further difficulties in fleshing out this project, but a cursory consideration doesn’t flag any that would deter me from pursuing the project further. AppleScript abounds with irritations, but irritations can be dealt with: impossibilites cannot.