A while ago, I wrote a little ruby script for our ward clerk that I
came across the other day while doing some spring cleaning of my home
directory. I thought it might be useful to the general LDS community,
so I'm posting it here. It uses the mechanize and pdf-writer gems to
screen scrape the online membership directory, pulling off the photos,
and creating a PDF file with the photos and family names tiled 4x5 per
page.
Our bishop found the current (at the time, and still current AFAIK)
ward directory page awkward because 1) it can't be saved as a
stand-alone file and 2) it's inefficient for printing (the layout
makes for a very long document containing mostly whitespace). So this
is the fix.
It takes your lds.org username and password as command line arguments,
and proceeds to "log" you in, navigate to the page, download the pics,
etc. No browser required thanks to mechanize. It spits out a PDF named
Ward_Picture_Directory.pdf. Obviously it will only grab the pics for
your home ward, since lds.org directs you to your own home ward's page
when you log in.
There are all sorts of improvements I never got around to adding,
which you see listed at the top of the file. Oh, and certain (buggy)
versions of mechanize make it crash, so beware. I think the latest
version (0.7.6) is fine.
So, in hopes that it has some practical or educational value to
someone out there, here it is. Enjoy.
Dan
I actually wrote a similar ruby script to do the same, but mine
reformatted it with html and used the CSS printing rules to enforce
page-breaks, which, of course, don't work properly in ANY BROWSER!
lol. I'll gladly throw mine away in favor of yours.
Tim
> <ward_picture_directory_generator.rb>
Mister Ed