Copy link to clipboard
Copied
I need to create a custom renaming script and just can't seem to figure it out. I'm already in Bridge CS6 with the Batch Rename dialog open.
My files are currently named as such: ABC-100-name-01
I need them to read: ABC-100-01-name
Absolutely any help is appreciated! This will be an incredible time saver.
OK, try adding this to your scripts folder… Done slighty long hand so's you can swap about if needed…
To run select Custom Rename at the bottom of the Tools menu…
...#target bridge
#engine main
if ( BridgeTalk.appName == 'bridge' ) {
var toolMenu = MenuElement.find( 'Tools' ),
customRename = new MenuElement( 'command', 'Custom Rename', '-at the end of toolMenu', 'muppet009' );
};
customRename.onSelect = function () { renameFiles(); }
function renameFiles() {
if ( app.docume
Copy link to clipboard
Copied
OK, try adding this to your scripts folder… Done slighty long hand so's you can swap about if needed…
To run select Custom Rename at the bottom of the Tools menu…
#target bridge
#engine main
if ( BridgeTalk.appName == 'bridge' ) {
var toolMenu = MenuElement.find( 'Tools' ),
customRename = new MenuElement( 'command', 'Custom Rename', '-at the end of toolMenu', 'muppet009' );
};
customRename.onSelect = function () { renameFiles(); }
function renameFiles() {
if ( app.documents.length == 0 ) { return; }
var i, count, doc, file, parts, baseName, ext, oldName, newName;
doc = app.document;
count = doc.visibleThumbnailsLength;
for ( i = 0; i < count; i++ ) {
if ( doc.visibleThumbnails.type == 'file' ) {
oldName = decodeURI( doc.visibleThumbnails.name );
baseName = oldName.match( /(.*)\.[^\.]+$/ )[1];
ext = oldName.replace( /^.*\./,'' );
parts = baseName.split( '-', 4 );
newName = parts[0] + '-' + parts[1] + '-' + parts[3] + '-' + parts[2];
if ( ext != '' ) { newName += '.' + ext; }
file = doc.visibleThumbnails.spec;
//$.writeln( newName );
file.rename( newName );
};
};
};
Copy link to clipboard
Copied
Muppet Mark, I can't thank you enough!! Unfortunately this is my first script and I don't know what to do with this. I was trying to use the built in batch rename console before.
Copy link to clipboard
Copied
This is a bespoke solution… It don't use the batch rename dialog… If you search here you will find how to add this to the bridge app…
Copy link to clipboard
Copied
Did you get it to work…?
Copy link to clipboard
Copied
I'm struggling to find the time to dedicate BUT I'm still incredibly excited and so grateful for your help I'll definitely update this thread with my progress.
Copy link to clipboard
Copied
To get the above to work for you…
1. Copy & Paste the above syntax to a new window in the ExtendScript Toolkit… ( an app found in the utilities folder on mac )
2. Save file to your desktop… Name up to you but include the file extension .jsx
3. Go to Bridge app preferences… ( comm+k )
4. In the tab Startup Scripts locate and click the button Reveal My Startup Scripts
5. Drag your script in to this folder…
6. Quit and relaunch the Bridge app…
7. Accept the new script…
8. Run it from the Tools menu…
Copy link to clipboard
Copied
Works like a dream!! Thank you so much!
Copy link to clipboard
Copied
If it works then do mark it answered... It helps other forum users know when searching. TVM