OK, I worked it out – the regex structure is a little different between Perl and JavaScript… anyway here it is, appending the filename without any extension or underscores to existing keywords (either IPTC:Keywords or DC:Subject). // https://forums.adobe.com/thread/656144 // https://forums.adobe.com/message/9744916 // https://forums.adobe.com/message/9745231 #target bridge addNametoMeta = {}; addNametoMeta.execute = function(){ var sels = app.document.selections; for (var i = 0; i < sels.length; i++){ var md = sels.synchronousMetadata; md.namespace = "http://ns.adobe.com/photoshop/1.0/"; var Name = decodeURI(sels.name).replace(/\.[^\.]+$|_/g, ' '); //remove extension | remove underscores md.Keywords = md.Keywords + ";" + Name; } } if (BridgeTalk.appName == "bridge"){ var menu = MenuElement.create( "command", "Filename to Keywords - Removing Underscore", "at the end of Tools"); menu.onSelect = addNametoMeta.execute; } Quit Bridge. When you copy the 18 lines of source code, ensure that any quotes are straight and not curly. Save from a plain text editor or ExtendScript Toolkit with a .jsx extension and place in your Bridge Startup Scripts folder (use the preferences menu, startup scripts – reveal startup scripts). Then restart Bridge, enabling the script when prompted. Then select the files and go to the Tools menu and look for “Filename to Keywords - Removing Underscore”.
... View more