Peel Me A GREP

I am not a scripter, nor do I play one on TV. I know my share of HTML, CSS, and XML, but really I’m just an old school publishing geek who never tires of learning the next trick or tool. My hands are all GUI from years of keyboard shortcuts.

I know scripting is in my future. It’s just too powerful, too useful, too cool to put off much longer. And I am totally jealous of the power of scripters. It’s not like I haven’t tried. I’ve attended AppleScript and JavaScript seminars, but they didn’t stick. Hell, I have driven around an 800-page JavaScript book on the passenger seat of my car all summer, in hopes that it would start talking to me during my commute. No dice. So as a gentle, evolutionary step toward scripting, I’ve been working to learn GREP within InDesign

GREP was added to InDesign with CS3 as a more powerful means of finding and replacing text. While it sounds like something you should be inoculated against (“The nurse gave Johnny his Dip/Tet, his Grep, and a lollipop.”) it really stands for General Regular Expression Print. Forget the General and the Print part, the heart of it are these things called Regular Expressions, little secret codes that function in a Find/Change operation. And they make GREP searches a jillion times more powerful than a plain Text search.

Text search in InDesign only gives you four wildcards: Any Digit, Any Letter, Any Character, and Any Whitespace. GREP has those plus many more wildcards. It also lets you look for locations, like the beginning and endings of words and paragraphs. So you can say “find every word (of any length) starting with a capital letter”.

It lets you specify repeat values, so you can say things like, “find every number of three or more digits”. Or, even fancier, “find every hyphen in between numbers of three or more digits”.

And you can add logic, to say find “Mike” or “mike,”, or find every word ending in “ike,” except “Mike.”

And it lets you take any part of a found expression and leave it alone. So you can find phone numbers, add parens around the area codes, and leave the numbers themselves unchanged.

Combine this text-finding ability with Find Format settings, and I think it’s fair to say you can now Find/Change anything you can think of in an InDesign document. Providing you’re thinking of text, of course.

The only “problem” with GREP is, it’s more digital trivia to learn. Your brain’s already addled with passwords, keyboard shortcuts, file formats, and the names of all the actors on Barney Miller. For the love of Abe Vigoda, how are you going to learn GREP codes?

You can just start playing, but that can be frustrating to say the least, because like all coding adventures, you don’t get much feedback when you’re doing it wrong. Nothing happens, or the wrong thing happens and you have no idea how to fix it. I bought the O’Reilly Safari book on GREP in InDesign CS3, which very good, well worth the $10. But there’s something even better, and it comes from New Zealand.

For learning GREP, there’s a great, free online tool called The Lightning Brain GREPGrokker. It’s offered up by Rorohiko Ltd. who also have a bunch of free and commercial plug-ins for InDesign (make your own Sudoku! Sweet!). The GREP Grokker is an interactive tool for learning GREP. You can follow the step-by-step instructions and see how typing in certain codes selects text. Or you can type/paste in your own text and search on that. It is just so cool to see how the selection changes as you change your codes. It’s very “oooh”, “ahh”. Check it out. And check out Rorohiko’s other plug-ins. There’s some fun free stuff in there. Like if you used to love Quark’s Jabberwocky, they have a version of it for InDesign.

Thanks Dad

On a purely personal note:

My dad passed away on Sunday July 20 after a long battle with cancer. I am very thankful to have been with him when he passed, along with the rest of our immediate family.

He was a remarkable man. A larger-than-life character to whom life was joyous game. A tireless provider for his family. Fun-loving, mischievous, creative and strong. He made friends everywhere he went, and he went everywhere. Everyone he knew became a character in his show, a player on his team. He was an athlete and a fierce competitor. He was a veteran who loved the American dream. He was a businessman who saw opportunities everywhere. He always greeted you with a smile, made you laugh, and told you to “drive slow” on your way home. It meant more than just “be safe,” it meant “take things easy.” I hope that his spirit of ease, optimism, kindness, and generosity never leaves me.

Thanks, dad.

Log Blog

Police InTerrogation Room: The cold metal chair beneath me creaks as I lean back and squint. The voice of Jimmy Cagney blares rapid-fire from behind a searing white light. “Where were you on the night of December 12th 2006 at 9:03 PM?”

I smirk. Slowly lighting a candy cigarette, I cooly reply, “That’s easy. I was sitting in front of my laptop, saving a file called CheeseFace3.jpg.”

“We got ourselves a comedian here. What was the resolution of that file?”

“72 ppi.”


“sRGB ICE61966-2.1”

“Very funny. Where’d you save it to?”

“Macintosh HD:Users:Mike:Desktop:pixels_de_frommage”

A frustrated Cagney crumples his paper coffee cup. “Alright, you’re free to go. But watch yourself. We’ve got the ASPCA hot on your trail for using the Liquify Filter on your cats.”

He’s got me dead to rights there, but I won’t crack. I know where the smoking gun is and he doesn’t. I’m a free man.

How did I know about the CheeseFace file? Warrantless government wiretapping?
Ha ha ha. Heck no, that would be illegal.

Am I some DTP Rain Man? 15 minutes to Blatner… always have cheese balls and juice boxes before the podcast...

The Infinite Sadness of Google? Not yet. No, it’s something much more humble.
My Photoshop Edit Log.

Not THAT log, yew eedeeot!

Go to your Photoshop General preferences and you’ll see an item (unselected by default) called History Log. Happy happy joy joy.

Think of it as a limitless, text version of the History panel. Everything you do in Photoshop, down to the decimal point, can be dutifully enshrined in monospaced glory.

You have three options for where to record this info, and three levels of info to choose from. With Text File, you create or select a .txt document to be the repository of your deeds. With Metadata, you append this info to the file itself, so wherever it goes, so goes its history. You can see metadata by choosing File > File Info, or in Bridge, go to the Metadata Panel, and tip open Edit History. Oops, nothing to see here.

Or you can put on belt and suspenders and choose Both. In terms of what gets logged, Sessions just gives you the times you open and close files. Concise gives you openings and closings, plus a sequential list of the tools you employed. And Detailed is the version used by the other Police. Every breath you take, every move you make, every pixel you break, it’ll be watching you.

Why would you want such a log? I’ve used mine to keep track of how much time I spent on freelance work, and to remember settings I used, so I could replicate successful techniques. With the history log, I can do things like look at a printed book and compare the image on the page to the Smart Sharpen settings I applied months earlier. I’ve also used the log to see where I saved long lost files. I suppose I could use a notebook, but I write enough already, so I let Photoshop do the work.

I also just get a kick out of seeing my Photoshop habits. Looking at one log I kept from May 3, 2006 to February 4, 2007, I can see I worked on exactly 1003 files. I used 3 times as many curves as levels (473 to 185). More than a quarter of those files (277), I took into LAB. I was fairly decisive, choosing Undo 457 times. But I probably spent too much time touching up layer masks and adjusting opacity. The day I applied 202 consecutive brush strokes still bugs me. There must have been an easier way. I think you can learn a lot about how you use Photoshop from keeping a log. It might even help you improve your habits.

Despite its uses, part of me wonders if I should even be publicizing this feature. There is a capacity for evil here. Is the world ready for such radical transparency? Do we really want our employers to know how many times we’ve had to Undo? Or that we spent 63 minutes tweaking a layer mask? Mostly I think it’s OK because an employer who doesn’t have anything better to do with their time than to sift through the minute details of your edit log, might not be in business much longer.

If you do go with a detailed log, I think it’s a good idea to start a fresh one from time to time. They tend to get rather longish. If you’re lucky enough to work on one project at a time, you could start a new log with each project. For simultaneous projects, you could have a separate log file for each; you’d just have to remember to switch the preference to point to the right one. Or you could just turn logging off for projects you don’t want logged, and flip it back on again when posterity demands documentation, or when you’re just trying something out and want to be able to replicate it later.

There’s no special protection on the text log file, so you’re free to rewrite history, if you choose. If you’ve been warping your poor pets into hellcats, be sure to doctor the log before PETA comes knocking on your door.

Mapping Tags to Seizures

Playing with XML in an InDesign template tonight when I figured out what was causing one of my pettiest pet peeves.

The Problem: When you choose Map Tags to Styles you get a jumpy, flickering beachball/cursor, lasting for a very long time. I’ve waited more than a minute to regain control of the application. And the flickering back and forth between a normal cursor and a beachball is more irritating than a plain spinning beachball.

The Culprit: Preview is checked in the Map Tags to Styles dialog.

This is a sticky application preference, so InDesign will remember if you left it on last time, even in a different document.

My advice is keep Preview unchecked and test out your mapping before opening the dialog box by applying some styles manually. You still may suffer the flicker when you click OK, but it seems to be shorter in length when you map specific styles. It’s almost like Preview is loading every style into memory. And this way, you only flicker if you choose to go ahead with the mapping in the current document. If you do Preview, uncheck it before leaving the dialog.

By the way, my flickering problems were always on a PowerBook G4. The problem may not happen as much on a speedier Intel. I’ll have to check that out when I get a chance.

A Tailored Fit

It’s the topic that just won’t go away, at least in my mind. InDesign’s Fit Selection In Window command. In his comment, David injected a dose of reality on my overhyped enthusiasm for this command. In my joy at finding such a hidden gem of a feature in my live-in application, I overlooked some limitations. So I spent a little time taking a closer look at when this command works really well, when it doesn’t, and what you can do about it. Here are a few tips for understanding and making the most of Fit Selection in Window.

  • FSIW adjusts the view so that the bounding box of the current frame(s) is centered and occupies no more than 50% of the window in any direction. Because of this, it will zoom a lot closer on frames that are squarish, than ones that are much wider than they are tall, or vice versa.

Employ FSIW on a square frame and you’ll zoom roughly twice a much as you will on a frame 4x as wide as it is tall.

  • The amount of zoom is also dependent on the amount of real estate available in the window. FSIW zooms the most with a fully expanded window. It doesn’t play well with tiled windows. For the same reason, your screen resolution matters. The higher the resolution, the greater the zoom.

  • Selecting text does not affect the zoom (it would be a lot cooler if it did). A blinking cursor yields the same zoom as selecting any or all the text in the frame. But the good news is, selecting a table or a cell within a table does affect the zoom. Selected tables and cells are zoomed on just like frames.
  • FSIW will zoom on inline frames and anchored items when they are selected with a selection tool, not with the type tool.
  • With text frames, the zoom is always greater with the type tool than either selection tool but the difference gets smaller with bigger frames. This shot shows four frames and the zoom percentages I got when I used the Selection tool (top) and the Type tool (bottom).

  • Since the nature of the command is to fit the entire frame in the window, the larger the frame, the less readable text will be. If you try it on a column that spans the height of a page, you will zoom out. Way out, to some village near Athens (where all your text is Greeked).
  • In those situations where FSIW just won’t zoom close enough, let your fingers do the walking. Since the key command here is command-option-= it’s a piece of cake to just lift a finger (the one one on the option key) and then hit command-= again as needed to zoom closer. After you do this a few times it becomes second nature.

Alright, I think I’ve exceeded the recommended daily dose of InDesign SubMicroMinutae. So that, my friends is the last I will be writing about Fit Selection In Window.


; )

Help! I Need Somebody!

Won’t you please help me help you?

Do you have any problems using InDesign or Photoshop? Ongoing struggles? Unanswered questions? Do you lie awake at night thinking there must be a better way of doing a particular task? Do you wish you were better trained in some little aspect of either of those programs? Friends, Romans, countrymen, lend me your errors.

I am starting a new project where I will be collecting and answering as many burning InDesign and Photoshop questions as I can. Not here, but on another famouser website, to be named later.

I’m looking for specific, finite questions that can be answered in a couple minutes or so. Quick hits. Things like “When is it better to use a vector mask instead of a layer mask in Photoshop?” or “Is there a way to update all missing links at once in InDesign?” Stuff like that. As long as it’s specific, no question is too simple, too obscure, too weird, too whatever.

If you have a question, post it here as a comment or shoot me an email at jmvrankin [at] I’d like nothing better than to have an inbox full of your problems. Thanks!