Automating Sanity: How I saved REI $12,000 with my first program

Apr 11, 2017

The first program I ever wrote saved my company more than $12,000.

It was the fall of 2014, and I had just started at REI as a production designer. Back then, REI was all in on newspaper ads—hundreds of them, each requiring meticulous resizing. My days blurred together in a haze of nudging logos and tweaking layouts, the monotony threatening to wear me down. Every task felt like another grain of sand slipping through an hourglass, and I was desperate for a way out

I'm not crying, you're crying

The worst part? The final step—saving PDFs, splitting them into individual files, and renaming each one—had me wearing out the Command, C, and V keys on my keyboard. It was the kind of tedious work that drains your energy and stifles creativity. I knew there had to be a better way. If I could automate this tedious task, I could redirect my energy to more creative endeavors like, well, more resizing and nudging.

That’s when I stumbled upon Script Editor, hidden in the depths of my Mac’s Applications folder. It’s a tool for writing automated scripts in languages like AppleScript—a quirky, old-school language designed for exactly this kind of repetitive task.

display dialogue "I like turtles."

With a bit of help from online tutorials, trial and error, and more than a few choice words, I managed to piece together my first functioning program. It wasn’t pretty, but it worked. I fed it a PDF with all the ads and a list of filenames, and voilà—perfectly named files appeared in a folder, like magic.

But I wasn’t satisfied with just sparing my 'C' key. If I could automate this part of the process, why stop there? I started wondering: Could I take it further? Could I automate the entire resizing and nudging process? Spoiler alert: I could.

I discovered that Adobe provides a comprehensive guide on how to programmatically use nearly every feature in InDesign. You can script actions in AppleScript, JavaScript, or, for some reason, VBScript. Seeing the potential, I decided to dive into JavaScript, one of the most popular programming languages out there. A free intro to JavaScript course on Codecademy got me started, and soon I was writing code.

Could I resize a page programmatically? Check. Override a master page? Check. Apply the correct master page when I have two different ones? Check. Keep all elements anchored correctly? Check. Figure out why all the elements were scattered across the page? Check… after realizing I missed a semicolon.

After countless failures and debugging sessions, I was ready for the ultimate test: Could I replicate an old job that originally took three days in just minutes? I set up my files, defined the layout constraints, and hit run. The script churned away, my computer fans hummed, and I watched as the screen moved on its own, the progress bar steadily filling. Minutes later, it was done. All 150 ads were perfect. What once took three days now took three minutes.

Even better, I later found out that while I was developing this script, REI had been considering outsourcing a similar task with a budget of $12,000. Not bad for a newly minted junior developer.

Though REI has since shifted most of its advertising spend away from print, the script did more than just save time and money. It was the catalyst that propelled me into the world of building solutions and solving real problems. It’s true what they say—you never forget your first.