/ Bash


One big win for any development workflow is automation of trivial repetition. Let's categorize as trivial repetition anything that turns the developer into a thoughtless robot.

For web developers, a common example of trivial repetition happens after changing some client-side code:

  1. Save changes in text editor
  2. command-tab to browser
  3. command-R to refresh page
  4. command-tab to text editor

A popular solution for this tedium is to put LiveReload into a gulp watcher. With this combination, the browser will automatically refresh every time you modify a file or directory that gulp is watching. In Node.js land, nodemon serves a similar purpose for restarting the server when relevant code has been changed.

Automation abides. Time is returned to your clock.

I've been working more and more with creating CEP panels for Adobe Creative Cloud apps, particularly for Photoshop at the moment.

When developing a CEP panel for a Creative Cloud app like Photoshop, there are times when you need to relaunch the Creative Cloud app to see the changes you made in the panel, like when you modify your manifest.xml or .jsx (ExtendScript) files.

Here is the trivial repetition implied:

  1. Save changes in text editor
  2. command-tab to Photoshop
  3. command-Q to quit
  4. Handle the unsaved changes dialog [1]
  5. Wait for Photoshop to quit
  6. Relaunch Photoshop
  7. Wait for Photoshop to open
  8. Open an asset
  9. command-tab to text editor
  10. Retire on a desert island (optional)

This is a lot work.

More critically, having a human brain involved in the process adds no value at all. Instead, the tedium of the whole reload workflow almost insures that your mind will go numb and you will start making small mistakes in the flow every now and again, squandering further time and mental power.

If the workflow can be written out in a simple list, it should be scripted.

So I did that: ccq is a very simple bash script that restarts Photoshop and opens a bundled image from the command line.

With a shell profile alias to the script, I can simply type either ccq in the terminal to politely ask Photoshop to quit (slow and safe), or ccq -f to kill the process (faster and destructive).

Either way, Photoshop will quit, relaunch, and open an image automatically.

With this script and alias alone, I have evolved as far as the web developer refresh workflow that I described at the beginning of this post. Obviously, this shouldn't be the stopping point, but it is an important step along the way.

As a next step, I'm interested in trying out how this script can be leveraged in a gulp watcher.

Feel free to try ccq for yourself. It has rough edges (some noted in the readme) and some limitations (e.g., Mac only). If you want to contribute to the repo, please feel free to submit a PR.

If you know of a better solution that's already out there, I'm all ears.

  1. When I'm developing a CEP panel, I don't care about unsaved changes to the open assets in Photoshop. In fact, I prefer that any changes are reverted. ↩︎