Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with batch renaming

New Here ,
Aug 23, 2013 Aug 23, 2013

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.

TOPICS
Scripting
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Aug 26, 2013 Aug 26, 2013

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

...
Translate
Guru ,
Aug 26, 2013 Aug 26, 2013

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 );

 

                    };

 

          };

 

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2013 Aug 26, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 26, 2013 Aug 26, 2013

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…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 27, 2013 Aug 27, 2013

Did you get it to work…?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 27, 2013 Aug 27, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 27, 2013 Aug 27, 2013

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…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 28, 2013 Aug 28, 2013

Works like a dream!! Thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 29, 2013 Aug 29, 2013
LATEST

If it works then do mark it answered... It helps other forum users know when searching. TVM

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines