Using Plucker with the Mac OS X command line

Why Bother?

The GUI front-end in the OS X Plucker download works quite well, but using the command line liberates you from clicking on little widgets and provides you with a wealth of possibilities.

You can write scripts that use the Plucker spider, that allow you do suck a page down to your Palm very concisely. Here is a little script that I use often; I call it "pp", and it lets me type, say, pp http://lee-phillips.org/osx/plucker 2 z to spider the specified page to a link depth of 2 and put the result in the Palm install directory, giving it a reasonable name derived from the page address.

#!/bin/bash
shopt -s expand_aliases
alias pluck='/Applications/Plucker.app/Contents/Resources/parser/python/PyPlucker/Spider.py'
palminstall="/Users/lee/Documents/Palm/Users/phillips/Files to Install"
page=$1
linkdepth=$2
tgt=`echo $page | sed 's,http://,,' | sed 's,/,-,g' | cut -c1-12`
if [ $3 == "doc" ] 
then pluck -H $page --bpp=16 -f "$palminstall"/$tgt  --compression=doc -M$linkdepth
else pluck -H $page --bpp=16 -f "$palminstall"/$tgt  --compression=zlib -M$linkdepth
fi
echo "Done! Next hotsync will install\
`ls -l /Users/lee/Documents/Palm/Users/phillips/Files\ to\ Install`"

Sometimes I find myself looking at a page in Safari that I don't want to read now but will want to read later, so I made this little Applescript that calls the above script to put the page on the Palm:

on run
    set l to (text returned of (display dialog "How deep?" default answer "1"))
    tell application "Safari"
        set s to URL of document 1
    end tell
    do shell script "/usr/local/bin/pp " & "\"" & s & "\"" & " " & l & " zlib 2>&1 | /Applications/PipeAlert.app/Contents/MacOS/PipeAlert"
end run

This script uses the useful free program PipeAlert to display the output (progress and error messages).

These two scripts are quite crude, but they might serve as examples of startingpoints, and demonstrate the utility of command line access to the Plucker scripts.

Please email me with any notes or comments you think might be useful to others, and I'll include your messages here (tell me if you prefer to be anonymous).

Previous: Image Handling Externals   Up: Intro