Run Script on All Open Files

CN
Posted By
chad_n_walker
Dec 14, 2006
Views
715
Replies
4
Status
Closed
I have a script that works great. I just need it to run on all my open files. Can this happen?

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

EH
Ed_Hannigan
Dec 14, 2006
Yes! Wanna know how?

Okay, okay. One way is to make an action that opens the script and run that from File>Automate>Batch.
CN
chad_n_walker
Dec 15, 2006
Actually, in this case that doesn’t work. The first file name gets thrown on all the files. There must be a way to script it within the script. Does any one know how to code it?
B
Bernie
Dec 15, 2006
Perhaps if you explained with a few more details, what you’re trying to do?
EH
Ed_Hannigan
Dec 15, 2006
Chad,

Worked perfectly for me. What steps are you taking in what order? My action was very simple; one step only, consisting of running the script.

The script I am using is AddFileName, which I downloaded from the AdobeExchange, It goes like this(with comments):

// this script is a variation of the script addTimeStamp.js that is installed with PH7

if ( documents.length > 0 )
{
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;

try
{
var docRef = activeDocument;

// Now create a text layer at the front
var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = "Name";

var myTextRef = myLayerRef.textItem;
myTextRef.contents = docRef.name;

// off set the text to be in the top left corner
myTextRef.position = new Array( 12, 20 );
}
catch( e )
{
// An error occurred. Restore ruler units, then propagate the error back // to the user
preferences.rulerUnits = originalRulerUnits;
throw e;
}

// Everything went Ok. Restore ruler units
preferences.rulerUnits = originalRulerUnits;
}
else
{
alert( "You must have a document open to add the filename!" ); }

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

Related Discussion Topics

Nice and short text about related topics in discussion sections