I often do presentations using Apple's Keynote. In many cases, I use lots of web resources for URLs and screenshots. I've always had a problem where people are asking me for a list of links referenced in a presentation, because they couldn't write them down fast enough. So I wrote two handy one-liner Unix programs in order to extract all or certain URLs from a Keynote presentation.
Note: I originally wanted to do this using AppleScript, but unfortunately, Keynote does not yet offer any possibilities for accessing text and links through AppleScript. That's why I wound up using the shell instead. Both one-liners require you to set the current directory to the top-level directory within the Keynote presentation bundle. The most comfortable way to switch to it is by typing "cd " (yes, with a trailing space) in Terminal.app (or iTerm) and then dragging your Keynote presentation from the Finder to the shell, and pressing Return in the shell window.
This first version extracts all URLs from the Keynote presentation, regardless of whether they are hyperlinked or not -- we just filter for text beginning with http://. This is handy if you write plain URLs as text:
[robg adds: These two worked as described when I tested them.]
Note: I originally wanted to do this using AppleScript, but unfortunately, Keynote does not yet offer any possibilities for accessing text and links through AppleScript. That's why I wound up using the shell instead. Both one-liners require you to set the current directory to the top-level directory within the Keynote presentation bundle. The most comfortable way to switch to it is by typing "cd " (yes, with a trailing space) in Terminal.app (or iTerm) and then dragging your Keynote presentation from the Finder to the shell, and pressing Return in the shell window.
This first version extracts all URLs from the Keynote presentation, regardless of whether they are hyperlinked or not -- we just filter for text beginning with http://. This is handy if you write plain URLs as text:
gunzip -c index.apxl.gz | perl -pe "s/</\n</g" | \
grep 'http://' | perl -pe 's!.*(http://[^<"]*).*!\1!' | sort -u
Alternatively, you may use this version, which will find the objects which are hyperlinked in Keynote. This is handy when you want to link screenshots, etc. as well:
gunzip -c index.apxl.gz | perl -pe "s/</\n</g" | grep 'http://' | \
perl -pe 's!.*<sf:link href="(http://[^"]*).*!\1!' | sort -u
Happy Keynoting!
[robg adds: These two worked as described when I tested them.]
•
[6,022 views]

