Jump to content


Working With Photoshop Scripts

  • Please log in to reply
No replies to this topic

#1 NishaaNt~

  • Jr. Member
  • 13 posts

Posted 23 August 2010 - 08:03 PM

*thanks to jennifer*
*request: i m not publishing any link here,,its default and beneficial,so moderators pls dont object it,i tried some editing in links,but it can be happen of left overing*
*NOTICE: all subjects are true for latest version 11(CS4)*

Posted Image
Working With Photoshop Scripts

Increase Your Productivity
Many people are not familiar with the power of Photoshop Scripts and aren't aware that there are many excellent sample scripts and learning guides included with Photoshop. This tutorial will show you where to find the Photoshop Scripting Guides, show you how to install Photoshop Scripts, and explain how to work with Photoshop Scripts.

Posted Image

Scripting Photoshop, Part 1 An Introduction
Whether it's automating tedious tasks, customizing commands, or adding new features, scripting makes almost anything possible in Adobe Photoshop.

The ability to script Photoshop debuted back in version seven as an optional plugin that could be downloaded from Adobe's website. As of version eight (CS), the scripting plugin is installed by default. Now, in version ten (CS3) and 11(CS4), scripting the backend of Photoshop is more accessible and powerful than it's ever been. Yet despite how long scripting has been part of Photoshop, it's surprising how few people take advantage of it and even more surprising, is the number of people who aren't even aware that Photoshop can be scripted.

Read the rest of Scripting Photoshop, Part 1 An Introduction.

Scripting Photoshop, Part 2 A Practical Example
In Part 1 of this two-part tutorial about scripting Photoshop, we covered some of the basics of using scripts, as well as the many resources available. In this second part, we'll create a practical, real-world script from scratch.

As mentioned in the Introduction to Scripting Photoshop, toggling the visibility of a layer (on and off) is an example of conditional logic, something for which scripting is ideally suited. So, let's see how you would write such a script from scratch.

For this project we'll use JavaScript because it's the only cross-platform scripting language supported by the Creative Suite; however, you could just as easily write a similar script using AppleScript for Mac, or VBScript for PC.

Read the rest of Scripting Photoshop, Part 2 A Practical Example.

So Why Use Scripts Instead Of Actions?
Photoshop Scripts are Actions on steroids, and Scripts can be super smart. From the official Adobe Scripting Guide come these examples of scripting power:
  • You can add conditional logic, so that the script automatically makes "decisions" based on the current situation. For example, you could write a script that decides which color border to add depending on the size of the selected area in an image: "If the selected area is smaller than 2 x 4 inches, add a green border; otherwise add a red border."
  • A single script can perform actions that involve multiple applications. For example, you could target both Photoshop CS2 and another Adobe Creative Suite 2 Application in the same script.
  • You can open, save, and rename files using scripts.
For a complete understanding of the power and complexity of scripts read through the Scripting documentation that came with your Photoshop application installation. This includes The Photoshop AppleScript Reference.pdf, The Photoshop JavaScript Reference Guide.pdf, The Photoshop Scripting Guide.pdf, and The Photoshop VBScript Reference Guide.pdf. All of them can be found in the Photoshop/Scripting Guide folder (CS & CS2 versions).

The PDFs are also available online at Adobe's Photoshop Scripting Documentation page, or you can purchase a printed version, "Adobe Photoshop CS2 Official JavaScript Reference" which is available at amazon.com for $26.39.

Unleash The Power Of Photoshop Scripts
Posted ImageBecause of the way that Scripts can instruct Photoshop to automatically execute a set of desired actions or commands, scripts can be very useful for carrying out repetitive tasks. For instance, you could use a script to close all of your current documents without saving and without prompting to save changes, or you could use a script to convert a document color profile to sRGB, launch Save For Web and then reset the color profile after you exit Save For Web.

The two I've just mentioned exist and are free scripts that you can download from Trevor Morris and Jeff Tranberry respectively. Yes, others have done all the hard grunt work and left us with the sweet rewards of their creations. I'll show you exactly where to get them below, but right now let's look at how to load a script.

Installing A Photoshop Script
After downloading a script you must copy it into your Scripts folder. On a PC, the path would be:
C:\Program Files\Adobe\Photoshop (CS or CS2)\Presets\Scripts\

On a MAC the path would be:
Applications> Photoshop (CS or CS2)> Presets> Scripts.

After copying a script to this folder you'll need to Quit and then Restart Photoshop before the script appears in the File> Scripts menu.

To Run A Photoshop Script
Posted ImageTo run a script choose File> Scripts and select the script from the list, which will include any script file that was saved with a .js or .jsx extension and saved in the Presets/Scripts folder. If you want to run a script that was saved in a different location, simply choose File> Scripts> Browse and navigate to the specific script you want to use.

To Set Scripts To Run Automatically
You can have an event such as saving or exporting a file trigger a JavaScript in Photoshop. Here's how:

Posted Image Choose File> Scripts> Scripts Events Manager. Select Enable Events To Run Scripts/Actions. From the Photoshop Event menu, choose the event that will trigger the script.

Select Script and then choose the script to run when the event occurs. The event and its associated script will be listed in the dialog box.

To disable and remove individual events, select the event in the list and click Remove. To disable all events, but keep them in the list, deselect Enable Events To Run Scripts/Actions.

Photoshop Sample Scripts
Photoshop ships with several sample scripts which can be found in the Scripting Guide folder. To try them out choose Browse and then navigate to the Scripting Guide folder, open the Sample Scripts sub-folder, then the JavaScript sub-sub-folder, and you'll find a nice long list of scripts to pick from.

If you find one you really like, save all the above navigation steps by dragging it into your Presets/Scripts folder. Here are just a few of the sample JavaScripts you'll find in the CS2 folder:

Posted ImageActiveLayer.js
Posted ImageThis script demonstrates how to set the active layer to the last art layer of the active document or the first if the last is already active.
Posted ImageApplyFilters.js
If there is an active document, this script will create four different selections and apply a different filter to each one of the selections. The filters applied are "Dust and Scratches," "Despeckle," "Diffuse Glow," and "Glass Effect." After all filters are applied, the last selection is deselected.
Posted ImageCropAndRotate.js
Crop a 10-pixel border from the image, and rotate the active document by 45 degrees.
Posted ImageEmboss.js
Demonstrates how you can use the action manager to execute the Emboss filter.
Posted ImageLoadSelection.js
This script will demonstrate how to load a selection from a saved alpha channel.
Posted ImageMosaicTiles.js
This script demonstrates how you can use the action manager to execute the Mosaic Tiles filter.
Posted ImageMoveToLayerSet.js
This script will demonstrate how to duplicate the first layer and move it to the end of a new layer set.
Posted ImageRotateLayers.js
This script demonstrates how to rotate a layer 45 degrees clockwise.
Posted ImageSelectionStroke.js
Creates a selection and create a border around it. The script then sets the stroke color and width of the new stroke.
Posted ImageSetChannels.js
Assuming there are "Red" and "Blue" channels in your document, make the "Red" and "Blue" channels the active channels of the document.

Photoshop Scripts & Resources
If you get hooked you'll want to learn more about creating scripts and you'll be on the lookout for new ones to download, and so what follows are two really great Photoshop Scripting Resources that will keep you busy.

Free Photoshop Scripts From Trevor Morris
Posted ImageTrevor Morris from GFX^TM has updated his Photoshop Scripts page to include scripts for both Photoshop CS and Photoshop CS2. All scripts should now work in both versions of Photoshop. The scripts include:

Array Generator - generates a two-dimensional array by cloning the selected layer; user defines number of rows and columns, as well as the horizontal and vertical spacing.
Center Layer - a simple script that centers the active layer.
Close Without Saving - closes the current document without saving and without prompting to save changes.
Close ALL Without Saving - closes ALL current documents without saving and without prompting to save changes.
- contracts a selection that touches the document boundaries on one or more sides (which Photoshop is not capable of doing).
Import Folder As Layers - imports a series of images (from the designated folder) as named layers into a new document.
Layers to Comps - creates a layer comp for each layer in the active document.
Rename Layers - renames all layers in the active document using the supplied pattern (and numbers them).
Toggle Layer Visibility - toggle the visibility of the current layer (on or off).

You'll also find Event-Based Scripts for Photoshop CS2 and some installation instructions. Visit Trevor's site to download the Photoshop Scripts.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users