Photoshop supports external automation through scripting. In Windows, you can use scripting languages that support COM automation, such as VB Script. In Mac OS, you can use languages such as AppleScript that allow you to send Apple events. These languages are not cross-platform but can control multiple applications such as Adobe Photoshop, Adobe Illustrator, and Microsoft Office. In Mac OS, you can also use Apple’s Photoshop Actions for Automator to control tasks in Photoshop.
Choose File > Scripts and then select the script from the list. The scripts list includes all the script files saved with a .js or .jsx extension and saved in the Photoshop CS5/Presets/Scripts folder. To run a script saved in another location, choose File > Scripts > Browse and navigate to the script.
Photoshop has several sample scripts you can choose. To run a different script, choose Browse and then navigate to the script. For actions, choose the action set from the first pop-up menu and an action from that set in the second menu. The action must be loaded in the Actions panel to appear in these menus.