1. !pitter-patter

    Well, Al and Ben are somewhere in the air on the way to Michigan, which makes for the first time I’ve ever been away from Ben for more than a few hours, and the longest Al and I have been apart for a while, too.

    Smooth navigating at the airport, to the extent I got to see any of it. The TSA people are friendlier than I’ve ever seen them (though one of them gave me the stink eye for taking pictures near the security gates), and there was some minor chaos involving Ben’s car seat and stroller needing to be scanned. But it sounds like Al managed to nail down a pair of seats for them in the back of the plane, so maybe their air time will be pretty good, too.

    So now it’s me and a lengthy list of projects around the house, and a few power tools if I get really ambitious.

    Some things that will be weird:

    • Sense of anticipation that Ben’s about to wake from his nap, which I’ve had all morning

    • No evening bedtime routine

    • No 6 a.m. wake-up

    • No buzz of the baby monitor

    • No bottles to wash

    • No toys to pick up

    I think I’m going to stop dwelling on it. But it’s still weird.

    Keep reading →
  2. Big Cat 'Build a Glossary Entry from Selection'

    Part of the job involves making sure that every article I run includes links to Webopedia definitions for each technical term the author uses.

    Using BigCat, I’ve written a script that borrows from the basic “search for selection in Google” and expands it to include “search for selection in Webopedia, allow the user to accept the resulting URL, and add a pre-formatted entry to the glossary and the clipboard.”

    Next up is adding a simple looping script to add the code for definitions automatically when a word I’ve already looked up and glossarized is in a given document.

    I’m posting these things here, by the way, less because I imagine there’s someone else out there who has the same job as me, uses the same software as me and deals with the same problems as me, and more because, well, you never know who will find what useful. And I’m definitely benefitting from other people’s scripting knowledge as I put these together. Seems the best way to give back.

    –Open this script in a new Script Editor window.


    on main(s)

    &160;&160;&160;&160;– Webopedia’s sort of a pain: no transparent search URL, but it does seem to be smart about redirecting &34;/foo.html&34; to the appropriate entry, so we’ll bank on that:

    &160;&160;&160;&160;set baseurl to &34;http://networking.webopedia.com/&34; &38; s &38; &34;.html&34;

    &160;&160;&160;&160;open location baseurl

    &160;&160;&160;&160;

    &160;&160;&160;&160;–If jimmying the search works, offer a chance to add it to the glossary. On cancel, the script will die.

    &160;&160;&160;&160;display dialog &34;Add this to the BBEdit Glossary?&34;

    &160;&160;&160;&160;

    &160;&160;&160;&160;– On ok, make OmniWeb give us its frontmost URL (which we just opened with the &34;open location baseurl&34; command

    &160;&160;&160;&160;tell application &34;OmniWeb&34;

    &160;&160;&160;&160;&160;&160;&160;&160;set theFrontmostWindowID to item 1 of (ListWindows)

    &160;&160;&160;&160;&160;&160;&160;&160;set theFrontmostWindowInfo to (GetWindowInfo theFrontmostWindowID)

    &160;&160;&160;&160;&160;&160;&160;&160;set myURL to item 1 of theFrontmostWindowInfo

    &160;&160;&160;&160;end tell

    &160;&160;&160;&160;

    &160;&160;&160;&160;– make the URL into a properly formatted parenthetical &34;define&34; URL

    &160;&160;&160;&160;set the clipboard to &34; (&60;a href=’&34; &38; myURL &38; &34;’&62;define&60;/a&62;) &34; as string

    &160;&160;&160;&160;

    &160;&160;&160;&160;– open up BBEdit

    &160;&160;&160;&160;tell application &34;BBEdit&34;

    &160;&160;&160;&160;&160;&160;&160;&160;activate

    &160;&160;&160;&160;&160;&160;&160;&160;–point glossFolder at the Glossary/Webopedia folder

    &160;&160;&160;&160;&160;&160;&160;&160;set glossFolder to &34;Macintosh HD:Applications:BBEdit 7.1:BBEdit Support:Glossary:Webopedia:&34;

    &160;&160;&160;&160;&160;&160;&160;&160;–set the name of the new document to the selection used to search

    &160;&160;&160;&160;&160;&160;&160;&160;make new text document with properties {name:s}

    &160;&160;&160;&160;&160;&160;&160;&160;– file reference thingummer because AppleScript doesn’t seem to like to address teh file directly

    &160;&160;&160;&160;&160;&160;&160;&160;set myfile to a reference to file (glossFolder &38; s)

    &160;&160;&160;&160;&160;&160;&160;&160;– paste the newly created URL into the new document

    &160;&160;&160;&160;&160;&160;&160;&160;paste

    &160;&160;&160;&160;&160;&160;&160;&160;–save the newly created glossary file

    &160;&160;&160;&160;&160;&160;&160;&160;save front document to myfile

    &160;&160;&160;&160;&160;&160;&160;&160;close front document

    &160;&160;&160;&160;end tell

    end main

    Keep reading →
  3. Big Cat (secure) 'Copy to public_html'

    I’m periodically moving files into my public web space to share with others, which presents a few minor issues:

    • Macs are very tolerant of spaces in file names and several utilities (such as the screen grabber) insert them by default in some file names.
    • It's a small pain to type the URL.

    So I wrote a quick script for the Big Cat Script Menu plugin that takes a file selected by the mouse and copies it to my public_html directory using scp, replacing all the spaces in the name with underscore ("_") characters and copying the URL of the newly copied file to the clipboard for pasting into whatever means I’m using to relate the URL to someone else.

    Minor caveats:

    • I haven't made the variables all friendly to change, but I've annotated the script so you can figure out what to change easily enough
    • I use ssh-agent to make the process of copying stuff with scp relatively transparent and password free. If you don't have public keys and an agent of some sort set up, this script won't do you a ton of good. I recommend Xander Schrijen's SSH Agent, which makes ssh keys under a Mac pointy-clicky easy, and Sam's ssh agent tutorial as a decent set of instructions for generating and copying a public key for use with ssh. SSH Agent replaces the second half of his tutorial, especially if you add it to your startup items under System Preferences/Accounts/Startup Items.
    • It will copy multiple files if you've selected multiple files, but only the last one to be copied will be available in the clipboard.

    –Open this script in a new Script Editor window.


    – copy to public_html by Michael Hall &60;[email protected]&62;

    – For use with the Big Cat Scripts Plugin (http://ranchero.com/bigcat/)

    – copy to the Big Cat &34;files&34; folder in ~/Library/Application Support/Big Cat Scripts

    – Also: pretty much depends on having ssh keys set up on the remote server, either without a password, or with some kind of ssh-agent in place.


    on main(filelist)

    &160;&160;&160;&160;

    &160;&160;&160;&160;tell application &34;Finder&34;

    &160;&160;&160;&160;&160;&160;&160;&160;activate

    &160;&160;&160;&160;&160;&160;&160;&160;repeat with i from 1 to (count of items in filelist)

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;– scrub out the spaces from the file name and replace them with the _ character

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set AppleScript’s text item delimiters to &34; &34;

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set myname to (the name of item i of filelist)

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set ScrubbedName to every text item in myname

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set AppleScript’s text item delimiters to &34;_&34;

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set myname to every item of ScrubbedName as string

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;– copy the file over to the sever, replace ‘ix:public_html/’ to your remote host

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;do shell script &34;scp ‘&34; &38; (POSIX path of item i of filelist) &38; &34;’ ix:public_html/&34; &38; myname

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;– create a variable with the URL of the file on the remote server, replace &34;http://www.puddingbowl.org/~mph/&34; to your remote URL

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set myFile to &34;http://www.puddingbowl.org/~mph/&34; &38; myname

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;– copy the variable to the clipboard for pasting

    &160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;set the clipboard to myFile

    &160;&160;&160;&160;&160;&160;&160;&160;end repeat

    &160;&160;&160;&160;end tell

    &160;&160;&160;&160;

    end main

    Keep reading →