Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are many scripts for this task, here is one:
https://jkost.com/blog/2010/09/add-file-name-as-text-layer.html
If you can't script, you should be able to record the script into an action and add extra action steps to modify the text layer created by the script.
Copy link to clipboard
Copied
This is what I want, thank you very much.
Note for people who are trying to search the same methode, link provided doesn't work, so you can use this script:
// this script is a variation of the script addTimeStamp.js that is installed with PH7
if ( documents.length > 0 )
{
var originalDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.ERROR;
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 = "Filename";
var myTextRef = myLayerRef.textItem;
// strip the extension off
var fileNameNoExtension = docRef.name;
fileNameNoExtension = fileNameNoExtension.split( "." );
if ( fileNameNoExtension.length > 1 ) {
fileNameNoExtension.length--;
}
fileNameNoExtension = fileNameNoExtension.join(".");
myTextRef.contents = fileNameNoExtension;
// off set the text to be in the middle
myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
myTextRef.size = 20;
}
catch( e )
{
// An error occurred. Restore ruler units, then propagate the error back
// to the user
preferences.rulerUnits = originalRulerUnits;
app.displayDialogs = originalDialogMode;
throw e;
}
// Everything went Ok. Restore ruler units
preferences.rulerUnits = originalRulerUnits;
app.displayDialogs = originalDialogMode;
}
else
{
alert( "You must have a document open to add the filename!" );
}save it with .jsx extension, for instance: Caption Name.jsx Place the script in your Photoshop /Presets/Scripts folder.
Launch Photoshop.
Open your image.
Select File > Scripts > Caption Name
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more