

I'm going to run it and we'll watch here and we'll see the slides appear. So it's going to loop through there, create a new slide and populate it with each one. So that's just something that's just part of how Keynote works and how it's hardwired with these two special things. They either have a default title item or a default title item and default body item.

So default title item and default body item are these fixed things inside of Keynote that Java Script knows to look for.

Default body item, instead of default title item, to the same thing except cell 1 instead of cell zero. Then I'm going to set something called the default title item of that slide to the table.rows i so row two will be the first one here. So in other words I'm going to create a new slide based on this slide master template. Okay, so I'm going to create a newSlide = Keynote.Slide and I'm feeding it the information that baseSlide is going to be slideMaster which is this up here. So I don't want to include that one so I'm starting at one, I'm starting at the second row there. Now I said before it was zero based here so shouldn't it be starting at zero? Well, there's a header row here that says State, Name, Scientific Name. I++ means it's going to increase go from one to two, two to three, etc until it gets to the end of the table. It's going to loop starting at one through to the number of rows so table.rowCount. So this is where it's handy to do JavaScript because you can do just normal four loops here which if you've ever done JavaScript programming is standard. You could have chosen one of the other ones and you can certainly go ahead and edit the title and subtitle one as well to customize it's field which you need before you run this.Īlright, so here we go. So as I create new slides I'm going to create them using this slide template right there. So I'm using exactly the name of that slide in the master slide there to basically give it this variable here. Where does this come from? Well if I go to View, Edit, Masterslide in Keynote you can see here are all the masterslides and the first one is called Title ampersand subtitle. Then I'm going to create a variable called slideMaster and that's going to point to presentation.masterSlides. I only have one document opened in each one here so it avoids confusion. Now, presentation is going to be the first document in Keynote which is this one. So first document, first sheet, first table. Java Script is a zero based array language so zero is first, one is second, two is third. Table is going to point to, in Numbers, the first document, the first sheet, and the first table. Then I'm going to create something called table. Just shortens the typing for the rest here. So the first two lines are basically just going to declare the term Numbers with a capital N, as the Application numbers and Keynote with a capital K as the Application keynote. I wrote this very short little script here that will do exactly this. It turns out it's a lot easier to do this task in Java Script.

A lot more people know and I use it for lots of things so I try to stick with Java Script when I can. Java Script is much more modern and advanced programming language. Now ScriptEditor, in the past, has been used for AppleScript and you can switch between AppleScript and JavaScript. Well, I can using the ScriptEditor, which is an app that comes with your Mac, and some Java Script programming. I don't to have to create fifty different slides and copy and paste all this data across. This could be a lot longer text, whatever. It doesn't necessarily have to be this topic but you get the idea. It could be used for various different things. So I have fifty slides in the presentation. I want to create a presentation that has one slide each for the state and its flower. I also have the scientific name but I'm not going to use that here. It's got a list here of all the states and the state flower. So here I have a Numbers document with one sheet and one table in it. Say you had a presentation you wanted to create and the data for the presentation was in a spreadsheet. Video Transcript: Here's a super advanced tutorial that involves programming.
