How to Auto-Run Scripts on File Open in Photoshop

Automating tasks in Adobe Photoshop saves significant production time, especially when standardized operations need to occur the moment an image is launched. By using Photoshop’s built-in Script Events Manager, users can bind custom JavaScript or ExtendScript files to specific application triggers, such as the "Open Document" event. This guide outlines the exact setup required to automatically execute a custom script every time a file is opened in Photoshop.

Accessing the Script Events Manager

The configuration begins inside Photoshop's scripting utility:

  1. Launch Adobe Photoshop.
  2. Navigate to the top menu and select File > Scripts > Script Events Manager.

Configuring the Event Trigger

Once the Script Events Manager dialog box appears, follow these steps to link your custom script to the file-opening process:

  1. Enable Script Events: Check the box labeled Enable Events to Run Scripts/Actions at the top of the dialog window. If this option is disabled, no configured events will execute.
  2. Select the Photoshop Event: In the Photoshop Event dropdown menu, select Open Document. This designates the trigger that fires whenever any supported file is opened in the workspace.
  3. Select Your Script: Under the Script radio button, open the dropdown menu. If your script is already installed in Photoshop’s presets directory, select it from the list. If it is stored elsewhere, choose Browse... to navigate to your custom .jsx or .js file on your local drive.
  4. Register the Event: Click the Add button located on the right side of the dialog. The event pairing will appear in the active event list below, confirming that the "Open Document" action is now tied to your selected script.
  5. Apply Settings: Click Done to close the window and save the configuration.

Testing the Automation

To confirm the setup is working correctly:

  1. Open any image file via File > Open or by dragging a file into the Photoshop workspace.
  2. Observe the execution of your script. If written correctly, the script's logic will run immediately after the document canvas initializes.

Managing or Removing the Event

If you need to edit or stop the script from running automatically:

  1. Return to File > Scripts > Script Events Manager.
  2. Select the existing event from the list at the bottom of the dialog.
  3. Click Remove to delete the association, or uncheck Enable Events to Run Scripts/Actions to globally pause all event triggers.
  4. Click Done to apply the changes.