Copy link to clipboard
Copied
I am after a simple script that will automatically add the image filename to my photos as a text layer.
I need a .jsx file that I can download and add to my Photoshop scripts folder.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
yes, trouble is I don't really know what I'm doing.
I downloaded the script from https://tejwani.com/photoshop-script-insert-current-filename/
This sort of worked but required a step to decide on the script size and whether to include the file path or extension.
I used to have a script that just loaded the file name without this step but a change of computer meant I lost the script and I cannot find a replacement.
Copy link to clipboard
Copied
There are many script to add file name text layers.
// This script was hacked by JJMack
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
// LowerLeftFileName.jsx
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher
// bring application forward for double-click events
app.bringToFront();
if (!documents.length) {alert('There are no documents open.', 'No Document');} // ensure at least one document open
else { main();}
///////////////////////////////////////////////////////////////////////////////
// main - main function
///////////////////////////////////////////////////////////////////////////////
function main() {
/* Internal Photoshop Text name */
var fontName = "ArialMT";
var fontName = "TimesNewRomanPSMT";
var fontName = "Tahoma";
/* Text Color */
textColor = new SolidColor;
textColor.rgb.red = 255;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;
/* END Variables You can hard here */
// remember users Ruler avd Type Units and set ours
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
var testres = 72;
res = app.activeDocument.resolution;
if(res!=testres){ app.activeDocument.resizeImage(app.activeDocument.width.value,app.activeDocument.height.value,testres); }
var docName = app.activeDocument.name;
var doc = app.activeDocument;
text_layer = doc.artLayers.add(); // Add a Layer
text_layer.name = docName; // Name Layer
text_layer.kind = LayerKind.TEXT; // Make Layer a Text Layer
text_layer.textItem.color = textColor; // set text layer color
/* Do not set TextType to Pargarph Text so action can position text layer
text_layer.textItem.kind = TextType.PARAGRAPHTEXT; // Set text layers text type
*/
text_layer.textItem.font = fontName; // set text font
text_layer.blendMode = BlendMode.NORMAL // blend mode
text_layer.textItem.fauxBold = false; // Bold
text_layer.textItem.fauxItalic = false; // Italic
text_layer.textItem.underline = UnderlineType.UNDERLINEOFF; // Underlibn
text_layer.textItem.capitalization = TextCase.NORMAL; // Case
text_layer.textItem.antiAliasMethod = AntiAlias.SHARP; // antiAlias
if (doc.width>=1001) fontSize = 60;
else fontSize = 10;
text_layer.textItem.size = fontSize; // set text font Size
text_layer.textItem.position = Array(fontSize, (doc.height - fontSize )); // set text layers position in and down
try{
text_layer.textItem.contents = decodeURI(app.activeDocument.fullName);
}
catch (er) {
text_layer.textItem.contents = activeDocument.name;
//alert("Error Setting Contents...");
}
if(res != testres){ app.activeDocument.resizeImage(app.activeDocument.width.value,app.activeDocument.height.value,res); }
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
}
///////////////////////////////////////////////////////////////////////////////
// END - main function
///////////////////////////////////////////////////////////////////////////////