Copy link to clipboard
Copied
Hi,
I'm about to create a script to check some tifs and jpgs for the right height and width, resolution and so on.
I could get it to work if I see the files in the content panel (looping through the files by app.document.getSelection ...
The script needs to check many files in different subfolders (all in one parent folder), so I don't like to use a collection to reveal all files of all subfolders first and then start the script.
My plan is to choose the parent folder in the folder panel and the script should loop through each file of each subfolder ...
So maybe there's someone who knows a solution for this problem, it would be great!
Thanks a lot,
Sebastian.
Copy link to clipboard
Copied
This should get you started...
#target bridge
var folders =[];
folders = FindAllFolders(Folder(app.document.presentationPath), folders);
folders.unshift(Folder(app.document.presentationPath));
for(var a in folders){
var fileList = folders.getFiles(/\.(jpg|tif)$/i);
for(var p in fileList){
var thumb = new Thumbnail(fileList);
var height = thumb.core.quickMetadata.height;
var width = thumb.core.quickMetadata.width;
var Resolution = thumb.core.quickMetadata.xResolution;
if(Resolution ==0) Resolution =72;
//do your processing here
//$.writeln(decodeURI(thumb.spec) + "," + height + "," + width + "," + Resolution);
}
}function FindAllFolders( srcFolderStr, destArray) {
var fileFolderArray = Folder( srcFolderStr ).getFiles();
for ( var i = 0; i < fileFolderArray.length; i++ ) {
var fileFoldObj = fileFolderArray;
if ( fileFoldObj instanceof File ) {
} else {
destArray.push( Folder(fileFoldObj) );
FindAllFolders( fileFoldObj.toString(), destArray );
}
}
return destArray;
}
Copy link to clipboard
Copied
Wow,
That was fast, I'll test it tommorow in the morning, thanks a lot so far!
Hopefully I'll be able to get our scripts together...
Thanks
Sebastian
Am 05.08.2012 um 20:13 schrieb Paul Riggott <forums@adobe.com>:
Re: looping through folders and subfolders
created by Paul Riggott in Bridge Scripting - View the full discussion
This should get you started...
#target bridge
var folders =[];
folders = FindAllFolders(Folder(app.document.presentationPath), folders);
folders.unshift(Folder(app.document.presentationPath));
for(var a in folders){
var fileList = folders.getFiles(/\.(jpg|tif)$/i);
for(var p in fileList){
var thumb = new Thumbnail(fileList
);
var height = thumb.core.quickMetadata.height;
var width = thumb.core.quickMetadata.width;
var Resolution = thumb.core.quickMetadata.xResolution;
if(Resolution ==0) Resolution =72;
//do your processing here
//$.writeln(decodeURI(thumb.spec) + "," + height + "," + width + "," + Resolution);
}
}
function FindAllFolders( srcFolderStr, destArray) {
var fileFolderArray = Folder( srcFolderStr ).getFiles();
for ( var i = 0; i < fileFolderArray.length; i++ ) {
var fileFoldObj = fileFolderArray;
if ( fileFoldObj instanceof File ) {
} else {
destArray.push( Folder(fileFoldObj) );
FindAllFolders( fileFoldObj.toString(), destArray );
}
}
return destArray;
}
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Bridge Scripting by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.
Copy link to clipboard
Copied
Did it work?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more