Category: Apple

Macs and stuff

Who should really be suing Apple?

Dickon's comment on my last post reminded me of another post from four years ago.

Imitation is the sincerest form of flattery, they say, but it can also be the most expensive.

Dear Apple, a billion dollars would be nice, but I think the Broadband Phone team would probably settle for some nice new MacBook Pros...

:-)

How you can actually find things with Spotlight

Mac tip of the week...

The Spotlight search engine is a really useful feature of Mac OS X, providing an easy way to open your files, email messages etc. But suppose you want to do something other than open them: how do you find out where they actually are? Is it showing you the copy on your internal drive, or your external drive? What other things are in the same folder? Can I copy it onto a flash drive?

A quick note for new Mac users: the 'Option' key is labelled 'Alt' on some keyboards.

Keep the customer notified

Here’s a handy utility for those using Mountain Lion’s new Notifications system (something I find I rather like despite never really getting on with Growl).

It’s called ‘terminal-notifier’ by Eloy Durán, and it lets you send these from the command line. So, for example:

   $ terminal-notifier \
     -message “Shall I compare thee to a summer’s day?” \
     -title “Morning greeting” -execute “open http://bbc.co.uk/weather/2653941”

This pops up a little notification, and clicking on it will take you to the BBC weather forecast for Cambridge.

You could put the command all on one line - I’ve just split it up with backslashes for readability. It’s easy to install terminal-notifier from the command line with:

  $ sudo gem install terminal-notifier

Now, as an illustration of why it can be useful, I wanted this for a particular purpose:

I’ve been experimenting more and more with Multimarkdown, since so much of what I write ends up in HTML, and the markdown syntax is a convenient way to create it. I have an Automator service which takes the currently selected text, for example in a blog post text-entry field, parses it as Markdown, and replaces it with the HTML equivalent. I’ve assigned it a keystroke, so typically I’ll just do Cmd-A to select everything I’ve typed and Ctrl-Alt-Cmd-M to convert it to nice HTML. Very handy. It’s how I wrote this.

Just occasionally, however, I might want to go back to the Markdown version, so before conversion the selected text is also copied into the clipboard. This is the kind of quick temporary backup that becomes second nature if you have a clipboard history utility. But it’s easy to forget this has happened.

Now, I can just add a quick extra line in the automator script and I get a little pop-up to remind me, which vanishes again after a few seconds:

Thanks, Eloy!

Here's what the Automator service looks like, in case anyone wants to do something similar:

Customise app defaults with AppleScript

Nobody likes AppleScript. Well, almost nobody. It's an attempt to make a programming language look like a natural language, which means that knowing what constitutes valid syntax in any given situation is almost impossible. I once suggested that what the world really needs is a Perl-to-Applescript translator, because Perl is a language that's pretty easy to write but impossible to read, and AppleScript is easy to read but impossible to write. The syntax is a bit dependent on the apps with which you're trying to interact, too, and the debugging options are exceedingly limited.

But the most annoying thing is that, on occasion, it's exceedingly useful, and there aren't really good alternatives for the kind of things it can do.

So just in case anyone out there is googling for this kind of thing, here's how I made it change the default options on a dialog box that I use every day.

I've been inspired by David Sparks's e-book Paperless, and my new-found fondness for the kind of things you can do with the Hazel utility, to get a better, more automated workflow for scanning in documents.

A key component, of course, is that you want them to be OCRed so that you can search for them, or search within them, later. I want something that does this automatically, or can be made to do it automatically, when a scan ends up in a folder on my disk, with minimal manual intervention. Good OCR programs are fairly costly on the Mac - Abbyy FineReader, at £79, is generally agreed to do the best OCR job, but the Mac version is not very scriptable. PDFpen, at £47, does a reasonable job and has better scriptability, and if I were starting now I'd probably use that.

But a while ago I splashed out on NeatWorks, which has good OCR, plays nicely with my wonderful ScanSnap scanner, and provides a complete filing system for my documents, with flexible metadata options. It's a nice package. But the problem is that I no longer want a complete filing system for my documents - I want to do that myself.

So for the moment I'm using NeatWorks to capture my scans, OCR them, enter some metadata and then export them as PDFs to the folder where Hazel and other things take over. They typically stay in NeatWorks for about a minute.

OK - that was a long run-up to explain why I regularly - often several times a day, do File > Export... and get this dialog:

At this point I can almost just hit [Return], except for one problem: the default is to export all the items in the currently selected folders and I just want to export the thing I last scanned. So every time I do this, I have to switch from keyboard to mouse, click the little radio button by 'Selected items only' and then carry on.

AppleScript to the rescue! I used Automator to create a service that just applies to NeatWorks and runs the following AppleScript:

This runs 'File > Export...', clicks the appropriate radio button, and then clicks the Export... button.

Finally I used the Keyboard section of System Preferences to assign a keyboard shortcut to this service.

Now, I drop some paper into the scanner and press the button on the front. NeatWorks pops up and OCRs it. I type in a title, document date and any other keywords I fancy, then just hit my magic keystroke and check the name and folder before hitting return to save.

At that point, Hazel takes over and does something like "if this file was created by NeatWorks, and has a name containing the word 'Telemarq' and the word 'receipt', then file it away in the appropriate folder of my receipts directory with a suitably reformatted filename".

Applications Open

A guy who worked on Mac repairs and maintenance told me a good way to test whether a Mac's hard disk is working reliably. "Oh", he said on the phone, "you can kinda stress-test it by opening the Applications folder and doing Cmd-A Cmd-O".

It took me a moment to click just what he was saying: Cmd-A selects everything in the folder. Cmd-O opens things that are selected. In the case of apps, it will run them. So these two quick keystrokes will try to launch, simultaneously, every app installed on your machine.

"It usually takes 5 minutes or so, depending on the machine", he continued. "But if there's something wrong with the system this will usually find it." Yes, I said, I imagined it would.

Now, I admit I haven't tried this with my machines yet, but I did try it last time I was in the Apple store. And it's a really good way to demonstrate the difference between hard-disk- and SSD-based machines!

Two things worth knowing if you try this experiment:

  • One of the things that will open at some point in this process is Time Machine. So your world will disappear into a star field until you close it!
  • Quitting 30 or 40 apps can be a pain unless you know the Cmd-Tab trick: if you're doing Cmd-Tab to switch between apps, you can tap 'Q' while still holding down Cmd to quit the app whose icon is currently highlighted. Typing Q lots of times is a good way to quit lots of apps quickly.

Cut and paste comes to the Mac

Well, OK, the title's a little misleading, but here's a very handy hint for anyone running Lion or later. It's to do with moving files.

Though the Finder has, for a very long time, supported the copying and pasting of files from one folder to another, it has never allowed cut and paste. I could never fathom why something so simple wasn't in there until I realised that, actually, there is a problem with implementing the concept cleanly: normally, when you cut things, they disappear. What happens if you cut a file but never paste it? Especially accidentally? (What happens on Windows? I forget...)

Still, this was an annoying omission, particularly if you're used to Windows, or if you have a small display without much space for dragging things about.

Well, now you can do it. Instead of the normal cut & paste keystrokes (Cmd-X, Cmd-V) you do a copy and a kind of alternate paste (Cmd-C, Alt-Cmd-V). Intuitive? No. But I guess it makes a kind of sense.

Thanks to the excellent David Sparks for the hint.

Obligatory Mac Utilities

There are a handful of utilities on my Mac that I use all day, every day. I’ve written about most of them before over the years -- try the search box on the right -- but since people liked some of my past posts about favourite iOS apps, I thought I’d gather these into a quick list here.

  • Dropbox
    But then, you could have guessed that one. It’s on everybody’s list. ’Nuff said.
  • LaunchBar
    Unless your needs are very minimal, you need something to launch applications and utilities without having to burrow through folders in the Finder. Some people just use Spotlight, but there are quicker and more powerful options. In the past, I tried most of them but settled on LaunchBar and, despite occasional experiments with others, and though I use a tiny fraction of its facilities, I’m still using it 10 years after first installing it.
  • A clipboard history utility
    These give you the ability to store more than one thing in your clipboard. Cut, Copy and Paste will work as expected, but you have the option to go back and paste the thing-before-last that you copied. Or things from yesterday. This is one of those habits that you may never get into; it took me a long time to get used to the fact that I could copy a quote from a web page, and the author’s name, and the URL, and then go to my blog and compose a post with all the information at hand. But it’s very liberating: you can stick stuff in the clipboard without worrying about what it’s overwriting, and the history becomes a sort of temporary scratch space, like the back of an old envelope on your desk, in which you can put all sorts of short-term stuff. There are several utilities about, but LaunchBar comes with a good one built-in, so I just use that. Trust me, train yourself to do this and make sure the keyboard shortcut is the same on all your machines. I use alt-cmd-L, which is quick to type, and has become as instinctive as the cut, copy & paste keystrokes.
  • TextExpander
    This lets you type just a few characters, in almost any app, and have them converted instantly into a much larger chunk of text, optionally with lots of clever extra features and options. If you’re me, for example, it doesn’t take long to discover that ‘Quentin Stafford-Fraser’, what with its punctuation and capitals, can be a tedious thing to type many times a day, and to type ‘qqsf’ and have it automatically converted is a much better option. My own email addresses, which these days are often my usernames on various services, each have their own three-letter abbreviation, and so forth.
    I first used this back when it was called Textpander, and was free, and when that changed, for a long time I resisted paying $35 for something that just typed a few keystrokes for me. Until, that is, I realised just how many keystrokes it had typed for me -- over 38,000 on this machine, for example (it keeps a record). I’m not sure over what time period that is, but that’s just on one of my machines, and I’m not a heavy user.
  • SuperDuper
    It clones your disk. Efficiently, flexibly and reliably, and if you're cloning your main system disk, it will make the result bootable. I don't use it often, but I do it without fail every single time I'm about to do a major operating system upgrade, so it's had a lot of use recently!
  • Scrivener
    Not a utility, this one, but a substantial application. They used to say of Emacs, that it was not so much a text editor, more a way of life. Well, Scrivener inspires almost religious devotion amongst its enthusiasts. It is a word processor designed for professional writers -- a category into which I certainly do not fall -- but I’ve become rather fond of it for gathering together information associated with any project, and if I were to write anything substantial, it’s certainly what I’d use. I could write a great deal about Scrivener, but others have done so in numerous places, so I’ll just mark it as a favourite, and encourage you to investigate for yourself. There are plenty of screencasts, podcasts, books and many other resources to tell you about it and why it's so yummy.
  • 1Password
    This is on all my devices, and in the toolbar of all my browsers on my Macs. How do people live without this (or something like it)? If you live without it by using the same password on many websites, then I hope you're spending the money on medication instead to help you sleep at night.

Visiting the Library

A tip for Mac users: The Library folder in your home directory contains miscellaneous preference files, support libraries etc, and most normal users seldom need to touch it, which is why it is hidden by default in Mac OS X Lion. The standard way to get to it, if needed, is to hold down Option while clicking the 'Go' menu in Finder, and it'll appear among the list of destinations.

If, however, you're not a 'normal user' you may wish to make it more visible, and this turns out to be very easy. Just open a Terminal window and type:

chflags nohidden ~/Library

And you should then see it in your Finder just like any other folder.

Thanks to MOApp for this one.