But, I recalled that a keynote document is nothing more than a zip archive around a bunch of files, one of which is a giant XML file containing most of the base content. After a half hour of experimenting, I figured out that the difference between a broken save and a good save was the presence of a single XML element. So I wrote a quick script to remove the XML element, and rebuild the zip archive:
Now, I can get on with my Keynote development, just remembering to run this script once to start a new editing session. I just pop open a local Terminal window, type "fix-keynote-outline" followed by a space, then drag the keynote file into the Terminal window, which automatically pastes the full unix path. I press return, and within a few seconds, a new keynote file appears with the outline mode restored.#!/usr/bin/env perl use strict; $|++; use Cwd qw(abs_path); use File::Temp qw(tempdir); @ARGV = map abs_path($_), @ARGV or die "$0: please give keynote zip names on command line"; while (@ARGV) { my $key = shift; -e $key or die "$key not found"; my $tempdir = tempdir( CLEANUP => 1 ); chdir $tempdir or die "cannot cd $tempdir: $!"; system "unzip", $key; my $flag = 0; { local @ARGV = "index.apxl"; local $^I = "~"; while (<>) { s#(<key:BGShowUIStateOutlineWidth>.*?</key:BGShowUIStateOutlineW +idth>)## and $flag = 1 and warn "removed $1"; print; } } (warn "no changes made, skipping\n"), next unless $flag; my $old_key = $key; $old_key =~ s/\.key$/ OLD.key/ or $old_key .= "-OLD"; (warn "unsafe to mv $key $old_key, skipping\n"), next if -e $old_key +; rename $key, $old_key or die "cannot mv $key $old_key: $!"; system "zip", "-r", $key, '.'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Work around a bug in Apple Keynote '09
by graff (Chancellor) on Mar 15, 2009 at 23:25 UTC | |
|
Re: Work around a bug in Apple Keynote '09
by Anonymous Monk on Mar 18, 2009 at 05:46 UTC | |
by Anonymous Monk on Mar 18, 2009 at 07:00 UTC | |
|
Re: Work around a bug in Apple Keynote '09
by pmonk4ever (Friar) on May 14, 2009 at 15:56 UTC |