Using the Script Listener


In this example, we're going to modify the script we created in the tutorial on page 156. However, we're going to do it with the Script Listener. Why, you ask? Because I need to fill a few more pages in the book. Just kidding, I'm probably already over my page count, but I do want to demonstrate what you can do with this plug-in. We're actually going to use it to add a drop shadow to a type layer because adding a layer style via script is really not as easy as you'd think. So instead, we'll let Photoshop write the code for us.

Step One

Open any photo in Photoshop. Create a new type layer with your name (or anything, for that matter) on it.

©MATT KLOSKOWSKI

Step Two

Click once on the type layer in the Layers palette to make it active. Delete the Script Listener JavaScript log file on your computer. Don't worry, you're not deleting the plug-in file that you added in the Installing Script Listener tutorial. The actual JavaScript log file will always automatically be recreated if you delete it. Also, make sure you only delete this file when you're absolutely ready to have Script Listener record your actions. Remember how ugly the code looked? You don't want to have to sift through all that to find your specific commands.

Turbo Boost

You can manage Bridge-specific scripts in Bridge by choosing Edit>Script Manager.


Step Three

Since you just deleted the log file, whatever you do from this point will be recorded in a new JavaScript log file by Script Listener. Click on the Add a Layer Style icon at the bottom of the Layers palette and choose Drop Shadow from the pop-up menu. You can adjust the settings here or just use the defaults for this example. Click OK and don't do anything else. I repeat...don't do anything else in Photoshop, yet.

Step Four

Find the JavaScript log file and open it in any text editor. First, look at the ugly code that it generates and be thankful that you don't have to type that yourself. Then press Command-A (PC: Control-A) to select all of the text and press Command-C (PC: Control-C) to copy it. Then, open the SpeedClinic script in the ExtendScript Toolkit editor, click at the end of the script, press Return (PC: Enter) until you get down to Line 34, and press Command-V (PC: Control-V) to paste the code from the log file.

Turbo Boost

If you're new to scripting, it's likely you're not using all of the panes you see on the left side of the screen. Feel free to choose Hide Pane from each one's flyout menu to free up some screen space.


Step Five

Add the following text on a line before the code:

Function addDropShadow() { 


Then type a right brace (}) on a line after the Script Listener code pasted in Step Four.

Step Six

What we've done here is added the code to create a drop shadow on the text layer to the SpeedClinic script. However, we need to tell the script to use this code, so click on Line 15 (just below newTextLayer.text Item.color = textColor;). Press Return (PC:Enter), then add the following on Line 16:

addDropShadow(); 


Turbo Boost

Opening the Script Listener log file can take a while as it gets larger. It's good to delete the actual log file often. If Photoshop doesn't see a log file there, it will just create a new one and start over.


Step Seven

That's it. Now you can save the script and run it again on any image and it'll create the gallery style print, but this time the type layer will have a drop shadow layer style on it, as well. I know it sounds simple but trust me, writing that code yourself would not be fun and the Script Listener plug-in really saves a bunch of time.

Turbo Boost

Visit www.ps-scripts.com for a great forum with discussions relating totally to scripting inside of Photoshop.




Photoshop CS2 Speed Clinic
The Photoshop CS2 Speed Clinic: Automating Photoshop to Get Twice the Work Done in Half the Time
ISBN: 0321441656
EAN: 2147483647
Year: 2006
Pages: 113

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net