Skip to main content
Pedro Cortez Marques
Legend
January 20, 2011
Question

Script to rename parent folder and refresh (F5) parent and parent/parent folders

  • January 20, 2011
  • 1 reply
  • 1348 views

Now I can already right-hand clic an image inside a folder at bridge and open a pop-up window to put any script.

But now I need to rename the mother folder of the image and refresh (F5) the folder where my image is and his parent folder also.

When we work the images of a folder, we put an "_" in the begining of the images parent folder.

I  also need to be sure to tell the folder to rename but put an IF: if the  folder already biguns with "_" an warn tell that someone is already  working there and it will not rename.

The fact is that we are 5 people opening folders of images and we need to know if someone is already working that folder and warn the others that we are working on a folder.

In fact, I wanted to use color labels to do this, but renaming usures me that if someone opens the directory out side of bridge (windows or mac system), will know if is worked or not.

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
January 20, 2011

Something like this?


#target bridge  
   if( BridgeTalk.appName == "bridge" ) { 
folderInUse = MenuElement.create("command", "Use Selected Folder", "at the end of Thumbnail");
}
folderInUse.onSelect = function () {
   canUseFolder();
   }
function canUseFolder(){
var CurrentFolder = decodeURI(Folder(app.document.presentationPath).name);
var ParentFolder = Folder(app.document.presentationPath).parent;
var inUseFolderName = "_"+CurrentFolder;
if(CurrentFolder[0]=='_'){
   alert("This folder is in use!\n Please try later");
   return;
    }else{
      Folder(app.document.presentationPath).rename(inUseFolderName);
      app.document.thumbnail = Folder(ParentFolder+"/"+ inUseFolderName);
        }
}

Paul Riggott
Inspiring
January 20, 2011

Sorry forgot you wanted a coloured folder, this will now change the folder colour to Red...


#target bridge
   if( BridgeTalk.appName == "bridge" ) { 
folderInUse = MenuElement.create("command", "Use Selected Folder", "at the end of Thumbnail");
}
folderInUse.onSelect = function () {
   canUseFolder();
   }
function canUseFolder(){
var CurrentFolder = decodeURI(Folder(app.document.presentationPath).name);
var ParentFolder = Folder(app.document.presentationPath).parent;
var inUseFolderName = "_"+CurrentFolder;
if(CurrentFolder[0]=='_'){
   alert("This folder is in use!\n Please try later");
   return;
    }else{
      Folder(app.document.presentationPath).rename(inUseFolderName);
      var Thumb = new Thumbnail(Folder(ParentFolder+"/"+ inUseFolderName));  
        Thumb.label="Select";
        app.document.thumbnail = Folder(ParentFolder+"/"+ inUseFolderName);
        }
}

Pedro Cortez Marques
Legend
February 11, 2011

Hi Paul,

I have tested this with ExtendScript Toolkit CS5, press F5 to test it with bridge and it worked.

But, when I put the script inside the bridge startup scripts folder, and restart it, It doesn't work any more.

...