Using JavaScript in Photoshop

Did you realize that you can write macros and scripts for Photoshop in JavaScript? Yes, JavaScript is everywhere. JSPatterns.com has a great article explaining how to write JavaScript for Photoshop.

In his example, author Stoyan Stefanov takes a layered Photoshop file, shows and hides certain layers, and saves the resulting image to a .png file. The files he saved were charts of guitar chords–156 images saved in an instant.

For example, showing a layer is as simple as the following:

app.documents[0].layers.getByName('11').visible = true;

Stoyan used an open-source library called mojo for generating chords, a Photoshop-generated save function, and about two dozen lines to put it all together. Makes me wonder what other JavaScript in Photoshop projects are out there.