RidingTheClutch.com

What did I work on this week? A script for Adobe Bridge

At my job I have a regular Friday review of everything I’ve worked on for the past week. Friday afternoon I print out a couple copies of all my Photoshop comps and meet with the bigwigs.

Adobe Bridge is a very quick way to preview images, view metadata, add keywords, etc. Bridge has the concept of a “collection” which is basically a smart filter. You do a find, filter the images you want to see, then save that filter for use later. Last Friday I created a filter to show me all the Photoshop files that had been modified on or after that Monday. Perfect—this is exactly what I worked on this week. But what happens next Friday? I need to delete the existing collection and recreate it. Seems like there should be an easier way…

Bridge saves the collection as a file in whatever directory you’d like. I opened that file in a text editor in the hopes it was just a simple list of plain text attributes. I was in luck:

["\n<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\n<collection version='200' target='bridge%3Afs%3Afile%3A%2F%2F%2FUsers%2Frob%2FDocuments%2FWork' specification='version%3D2%26conjunction%3Dand%26field1%3Dmimetype%26op1%3Dequals%26value1%3Dapplication%2Fphotoshop%26field2%3Ddatemodified%26op2%3DgreaterThanOrEqual%26value2%3D2008-09-08%26scope1%3Drecursive%26scope2%3DincludeNonIndexed'></collection>\n"]

Just a simple xml doc that lists the filters, awesome! Now just replace the date and I’m good to go. Sounds like a job for cron cron will periodically run a task and do “something” on your system. In my case I want to recreate that xml every Monday morning, setting the date to that day, and saving back to the collection file. A little research and here’s how to output the date in the format this xml file needs:

["\ndate +%Y-%m-%d\n"]

Now I just need a script file that puts that date into the xml and writes the result out to a text file. That looks like:

["\n#!/bin/bash\necho \"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\\\n<collection version='200' target='bridge%3Afs%3Afile%3A%2F%2F%2FUsers%2Frob%2FDocuments%2FWork' specification='version%3D2%26conjunction%3Dand%26field1%3Dmimetype%26op1%3Dequals%26value1%3Dapplication%2Fphotoshop%26field2%3Ddatemodified%26op2%3DgreaterThanOrEqual%26value2%3D$(date +%Y-%m-%d)%26scope1%3Drecursive%26scope2%3DincludeNonIndexed'></collection>\" > /Users/rob/Documents/Work/This\\ Week.collection\n"]

The first line tells the system to run this in the bash shell. The second line takes the text and writes it to the terminal. Note that the date command near the end is surrounded with $() so that it runs inline and returns the result. The very end of that line looks like this:

["\n> /Users/rob/Documents/Work/This\\ Week.collection\n"]

This takes the string that was just output to the terminal and puts it into a file named “This Week.collection” in the same directory as the rest of my comps (overwriting any file with the same name). I save the script in my home directory.

The last step is to run this script every Monday. I add a new line to my crontab:

["\n30    12    *    *    1    rob    /Users/rob/bridge_collection.sh\n"]

This says to run the script I just created at 12:30, every Monday of the week. I’m running it in the middle of the day to make sure that I’m here and the computer isn’t sleeping. Done! Now I can keep track of everything I’ve worked on during the week with one click in Bridge.

blog comments powered by Disqus