Copy link to clipboard
Copied
Hello,
I have a folder with many images into and I'm need to add metadata (keyword) to the images from folder's name.
Ex: folder name: "lemon iced tea" / images keyword: "lemon iced tea".
I didn't find a way to do it.
Can anyone help me??
Thank you!
...#target bridge
if( BridgeTalk.appName == "bridge" ) {
folderTokeys = MenuElement.create("command", "Add Folder Name to Keywords", "at the end of Tools");
}
folderTokeys.onSelect = function () {
var thumbs = app.document.selections;
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var FolderName = decodeURI(Folder(app.document.presentationPath).name);
for(var a =0;a<thumbs.length;a++){
var selectedFile = new Thumbnail
Copy link to clipboard
Copied
#target bridge
if( BridgeTalk.appName == "bridge" ) {
folderTokeys = MenuElement.create("command", "Add Folder Name to Keywords", "at the end of Tools");
}
folderTokeys.onSelect = function () {
var thumbs = app.document.selections;
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var FolderName = decodeURI(Folder(app.document.presentationPath).name);
for(var a =0;a<thumbs.length;a++){
var selectedFile = new Thumbnail(thumbs);
app.synchronousMode = true;
var xmp = new XMPMeta(selectedFile.synchronousMetadata.serialize());
xmp.appendArrayItem(XMPConst.NS_DC, "subject", FolderName, 0,XMPConst.PROP_IS_ARRAY);
var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
selectedFile.metadata = new Metadata(newPacket);
}
};
Copy link to clipboard
Copied
Hi SuperMerlin, this is just what I am looking for, However it does not seem to work with Adobe Bridge 2020. Would you know why this is and how I can modify the script to work with Bridge2020?
Thanks
Ron
Copy link to clipboard
Copied
This should still work. Where are you having problems? Note that presentationPath has some bugs and there are problems with certain special folders, but otherwise it should be fine.
Copy link to clipboard
Copied
Thank you so much for your response. Here is my current workflow. I have a 32 GB folder of product photos broken into many folders and subfolders, each folder named with a relevant product name or table of contents category name. The named folders are an ideal search paramenter when using a DAM (ResourceSpace). I was hoping to find a script that added the current parent folder (or folder name string) to either the metadata or keyword field, each name separated with a comma and space.
The script below does not seem to do a anything when implemented in Bridge 2020. I am not certain I am using it correctly. Should the script be applied to a folder or to selected group of images?
Thanks
Ron
Copy link to clipboard
Copied
var thumbs = app.document.selections;
That means it is working on your selected images.
Copy link to clipboard
Copied
Hello SuperMerlin,
It works perfectly! Fantastic!!
Thank so much!
Cheers!!
Copy link to clipboard
Copied
I always like to use these requests to learn to do the same in ExifTool (as it is more accessible to me than scripting):
exiftool -r '-Subject<${directory;s/\/$|\/|\d+|\w+\///g}' 'MAC FILE or FOLDER PATH'
I’m still trying to work out the command for Windows, the regex appears valid, but the entire path is still being incorrectly applied…
OK, here it is:
exiftool -r "-Subject<${directory;s/.+\/\b|\///g}" "WINDOWS FILE or FOLDER PATH"
There are no magic answers as folder paths can be complex and may break the regular expression, however the following code may be more robust than my previous attempts:
exiftool -r '-Subject<${directory;s/.*\/([^\/]*$)/$1/}' 'MAC FILE or FOLDER PATH'
exiftool -r "-Subject<${directory;s/.*\/([^\/]*$)/$1/}" "WIN FILE or FOLDER PATH"
Copy link to clipboard
Copied
Hello,
It's the script i need, but i am new in adobe bridge and i don't see where i can add this script and how i can run it ?
Can you please give me the steps to use this script to adobe bridge
Thank's
Copy link to clipboard
Copied
Once installed, the script “Add Folder Name to Keywords” will be available in the tools menu. Navigate into the folder and select the files, then select the menu command.
____________________
Prepression: Downloading and Installing Adobe Scripts
____________________
Saving JavaScript Source Code
Some scripts are offered as “source code”, rather than saved into a ready to use file. This is often the case with scripts found at the Adobe User Forums, GitHub, SourceForge etc. Simply select and copy/paste the script code into a plain text document, saving the file with a .jsx filename extension. Ensure that a double extension is not incorrectly added, such as .jsx.txt
NOTE: Only paste the source code into plain text editors, such as Notepad or Adobe ExtendScript Toolkit etc. Ensure that straight double-quote marks " do not become curly.
Adobe Bridge Script Installation Location
A quick way to locate the Startup Scripts folder:
Mac OS Example:
/Users/username/Library/Application Support/Adobe/Bridge CC 2018/Startup Scripts
Further information at the Adobe site:
https://helpx.adobe.com/bridge/using/adobe-bridge-workspace.html#enable_startup_scripts
Find more inspiration, events, and resources on the new Adobe Community
Explore Now