Would be great to have the Export as... function the ability to take the filename and add into the export files filename, and /or ability to add custom prefix!! Already a Suffix field exists. PLEASE!!!!!!!!!!!!!
Would be great to have the Export as... function the ability to take the filename and add into the export files filename, and /or ability to add custom prefix!! Already a Suffix field exists. PLEASE!!!!!!!!!!!!!
Next... if you used the Export as... function you would know what I am talking about. I work with files with several many artboards. And outputting them all through Artboards to Files works but for some reason takes forever. Using the export as... is fast. And much preferred - but it won't save with the PSD filename or allow to create a Prefix - suffic only.
Ok its been a request for years, but do you need to do this now? Because the evidence would suggest that it might not be a feature that is coming along anytime soon. So alternate ways to get where you need to be might be helpful.
Adobe devs have posted numerous times that Export is not finished. So who knows?
But for TODAY... is this a need or just a theoretical? Because we can help you find a way to do what you need, but we can't add a feature to the program. I'm offering some other ways to possibly do what you want. If that's not what you are asking for then I'll exit this thread.
I don't know what you mean "Adobe Bridge is a PITA." And from your tone, frankly, I don't care to.
As Lumigraphics said above, we are here to help you. We can't change the function of the software, but we may have the knowledge to help you get around your roadblocks. If you need help, we are here for you. If all you want to do is complain, then I will follow Lumigraphics out of this thread.
I work with files with several many artboards. And outputting them all through Artboards to Files works but for some reason takes forever. Using the export as... is fast. And much preferred - but it won't save with the PSD filename or allow to create a Prefix - suffic only.
Adding a custom prefix by typing into the field is different from using the filename. Perhaps if they added the ability to use a code such as "@@docname@@" or something, then it could use the document name without requiring a different field. Or perhaps a checkbox could automatically populate the field with the filename, and a radio button selection could set whether this is a prefix or suffix.
Sadly, Export As can't be scripted, so that is a dead end. There are alternative scripts to save artboards to files, however, I don't know if they are quicker or not. If they are quicker than the default artboards to files script, then they can be adapted to include prefix or suffix.
Another option is that a Photoshop script could batch rename the files that are output from Export As, changing the suffix to a prefix... But you would still need to enter the PSD name manually as a suffix when exporting, then run the script to rename the files.
EDIT:
The following script will copy the active document name (without extension) to the clipboard, ready to paste into the Export As Suffix field.
// Copy Document Name to Clipboard.jsx
#target photoshop
var d = new ActionDescriptor();
d.putString(stringIDToTypeID("textData"), activeDocument.name.replace(/\.[^\.]+$/, ''));
executeAction(stringIDToTypeID("textToClipboard"), d, DialogModes.NO);
I can only presume that you don't like using the Adobe Bridge Batch Rename tool... So here is a Photoshop script to batch rename a folder of files meeting the following condition of a unique separator, in this case, an underscore character. This is easily adapted to a hyphen or another unique character.
Filename-1_Suffix.png
To:
Suffix_Filename-1.png
The script will additionally preserve the original filename in the file metadata for easy recovery of the original filename.
/*
Rename Files in Folder Swapping Suffix to Prefix.jsx
https://community.adobe.com/t5/photoshop-ecosystem-ideas/export-as-add-prefix-function-to-auto-use-psd-filename-in-output-files/idi-p/13694701
v1.0, 2nd April 2023, Stephen Marsh
Notes:
* Change the RegEx capture group underscore (_) to a hyphen (-) or another unique separator as required
* The original filename will be set in the preserved filename metadata to facilitate restoration of the original filename via Adobe Bridge, ExifTool etc.
* To do: Add an option to restore the preserved filename via the script
Batch renames files from:
Filename-1_Suffix.png
Filename-2_Suffix.png
Filename-3_Suffix.png
To:
Suffix_Filename-1.png
Suffix_Filename-2.png
Suffix_Filename-3.png
*/
#target photoshop
var theInputFolder = Folder.selectDialog("Please select the folder to swap the filename suffix to prefix:");
var theInputFiles = theInputFolder.getFiles(/\.(gif|png|jpe?g|tif?f|psd|psb)$/i);
for (var i = 0; i < theInputFiles.length; i++) {
setPreservedFilenameMeta(theInputFiles[i], theInputFiles[i].displayName);
var theRegEx = theInputFiles[i].name.replace(/(^.+)(_)(.+)(\.[^\.]+$)/, '$3$2$1$4');
theInputFiles[i].rename(theRegEx);
}
app.beep();
function setPreservedFilenameMeta(theFile, theName) {
if (!ExternalObject.AdobeXMPScript) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(File(theFile).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var xmp = xmpFile.getXMP();
xmp.setProperty('http://ns.adobe.com/xap/1.0/mm/', 'PreservedFileName', theName), xmp.rawData = xmp.serialize();
if (xmpFile.canPutXMP(xmp)) {
xmpFile.putXMP(xmp);
}
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
Copy the code text to the clipboard
Open a new blank file in a plain-text editor (not in a word processor)
Paste the code in
Save as a plain text format file – .txt
Rename the saved file extension from .txt to .jsx
Install or browse to the .jsx file to run (see below)
Due to underwhelming demand, I have updated the script to a 1.1 version to include the ability to restore the preserved filename metadata, just in case the batch renaming doesn't go to plan. Simply hold down the ALT/OPT key when running the script.
/*
Rename Files in Folder Swapping Suffix to Prefix.jsx
https://community.adobe.com/t5/photoshop-ecosystem-ideas/export-as-add-prefix-function-to-auto-use-psd-filename-in-output-files/idi-p/13694701
v1.1, 7th April 2023, Stephen Marsh
Notes:
* Change the RegEx capture group underscore (_) to a hyphen (-) or another unique separator as required
* The original filename will be set in the preserved filename metadata to facilitate the restoration of the original filename via Adobe Bridge, ExifTool etc.
Changelog:
* v1.0: 2nd April 2023 - initial release
* v1.1: 7th April 2023 - Added an option to restore the preserved filename by holding down the ALT/OPT key when running the script
Batch renames files from:
Filename-1_Suffix.png
Filename-2_Suffix.png
Filename-3_Suffix.png
To:
Suffix_Filename-1.png
Suffix_Filename-2.png
Suffix_Filename-3.png
*/
#target photoshop
try {
// Hold down ALT/OPT to restore the preserved filename
if (ScriptUI.environment.keyboardState.altKey) {
if (confirm("Do you really want to restore the original filenames?")) {
var theInputFolder = Folder.selectDialog("Please select the folder to restore the original filenames:");
// Add or remove supported file types as required
var theInputFiles = theInputFolder.getFiles(/\.(gif|png|jpe?g|tif?f|psd|psb)$/i);
for (var i = 0; i < theInputFiles.length; i++) {
try {
// Get the preserved filename metadata
var xmpFile = new XMPFile(theInputFiles[i].fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_READ);
var xmpMeta = xmpFile.getXMP();
var preserved = xmpMeta.getProperty(XMPConst.NS_XMP_MM, "PreservedFileName");
// Rename the files
if (preserved != undefined) {
theInputFiles[i].rename(preserved);
} else {
alert("One or more files weren't renamed due to missing preserved filename metadata!");
}
} catch (error) {
alert(error + ', Line: ' + error.line);
}
}
app.beep();
}
// Rename using the suffix as the prefix
} else {
if (confirm("Do you really want to swap the filename suffix to a prefix?")) {
var theInputFolder = Folder.selectDialog("Please select the folder to swap the filename suffix to a prefix:");
// Add or remove supported file types as required
var theInputFiles = theInputFolder.getFiles(/\.(gif|png|jpe?g|tif?f|psd|psb)$/i);
for (var i = 0; i < theInputFiles.length; i++) {
// Set the original filename to the preserved filename metadata
setPreservedFilenameMeta(theInputFiles[i], theInputFiles[i].displayName);
// Swap the suffix for the prefix
var theRegEx = theInputFiles[i].name.replace(/(^.+)(_)(.+)(\.[^\.]+$)/, '$3$2$1$4');
// Rename the files using the suffix as the prefix
theInputFiles[i].rename(theRegEx);
}
app.beep();
}
}
} catch (error) {
alert(error + ', Line: ' + error.line);
}
function setPreservedFilenameMeta(theFile, theName) {
// Get the preserved filename metadata
if (!ExternalObject.AdobeXMPScript) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(File(theFile).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var xmp = xmpFile.getXMP();
xmp.setProperty('http://ns.adobe.com/xap/1.0/mm/', 'PreservedFileName', theName), xmp.rawData = xmp.serialize();
if (xmpFile.canPutXMP(xmp)) {
xmpFile.putXMP(xmp);
}
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
I already have several ways to do stuff outside of Photoshop - hence the ask to have it native in the software. @mglush when it comes to "complaining" about how bad Bridge is - that's a whole other pot to get into, and well noted by users.
Just my two cents that I'd love this, too. I have to create artwork daily across mutlitple social networks. I label each file according to the part number. I want all the social media files to have the part number as the prefix so when I go to update all the social media accounts, they're all in one spot in alphabetical order. I'd prefer they are all named with a prefix: "Part0001Insta" "Part0001Facebook". The way it works now as a Suffix, it is alphabetized first by the artboard names "InstaPart0001" "FacebookPart0001". The suggestions that other people are making like using Bridge, or to somehow rename after the fact defeats the purpose of this feature request to begin with. I have a very specific workflow and having this feature would be a HUGE time saver. As the OP stated, it already has SUFFIX as an option. Doesn't seem difficult to make PREFIX an option as well. When you're creating literally thousands of files a month, any time saving is a plus.