Reputation: 89
I would like to populate a keynote presentation with images that I have stored in my home directory.
Each image should go to one slide. I've looked a lot on the internet but I've only an example which doesn't work for me.
let app = Application('Keynote')
app.documents[0].currentSlide.images.push(app.Image({
file: Path("/path/to/image.jpg")
}))
This is the script I've done up to now.
app = Application('Keynote')
app.includeStandardAdditions = true
doc = app.Document({
documentTheme: app.themes['White']
});
app.documents.push(doc)
// Create and append a new "Title & Bullets" slide.
slide = app.Slide({
baseSlide: doc.masterSlides['Title & Bullets']
});
doc.slides.push(slide);
slide.defaultTitleItem().objectText="Hello"
slide.defaultBodyItem().objectText="Test1\ntest2"
doc.slides.push(slide);
slide.images.push(app.Image({file: Path("~/a.jpg")}))
The script above creates the presentation correctly and adds the text as it should, but it fails to add the image.
Any help would be appreciated.
Thanks in advance.
Regards, Pedro
Upvotes: 2
Views: 463