I routinely convert Word tables into a keynote presentation through automator - the resulting presentation invariably contains a few slides that have no text (empty cells in the original table, etc).
Below is a small script that will take out empty slides, but I’d like it to go through all slides in a presentation regardless of how many there actually are - as you can see I’ve got it working with just a repeat loop based on a list of numbers.
Any help would be greatly appreciated. Thanks in advance!
M
tell application "Keynote"
tell slideshow 1
repeat with i from 1 to 34
set slidebody to title of slide i
if slidebody is "Double-click to edit" then
delete slide i
end if
end repeat
end tell
end tell
Maybe code as follows helps you out. Please note that you need to iterate over the slides in reverse order (from end to beginning) to avoid index problems (deleting slide at index 17, makes former slide at index 18 the new slide at index 17…):
tell application "Keynote"
tell slideshow 1
set countslides to count of slides
repeat with i from countslides to 1 by -1
set slidebody to title of slide i
if slidebody is "Double-click to edit" then
delete slide i
end if
end repeat
end tell
end tell
Thanks so much for your help - the script works like a charm! I realize the solution may have been obvious but I’m very new to AppleScript and just starting out. Thanks again!