Question
Exploring and Exploiting the Bridge Libraries
One of the things we did when we developed the Bridge Workflow Automation Scripts, was create a set of libraries to make bridge scripting easier and more productive.
The libraries are AdobeLibrary1.jsx and AdobeLibrary2.jsx. There is an AdobeLibrary3.jsx, but it's primarily patches for the other two.
Over the next few weeks, I am going to post some messages about those libraries to help get folks started bridge scripting.
First up are some file handling utilities.
getBridgeThumbnails and getBridgeFiles are two library functions that return the selected (in Bridge) Thumbnail objects or File objects. getBridgeFiles takes the output from getBridgeThumbnails and converts them to File objects. These functions also ensure that any Version Cue files that were selected are up to date on the local file system prior to returning the selected objects.
The definition is:
getBridgeThumbnails = function( mask, getFolderChildren, filesOnly, firstOnly )
Where:
mask is a comma delimited list of file extensions or Mac file type strings. The function will only return Thumbnails that point to files of these types. It defaults to no mask, which will return everything. If the user selected Thumbnails that are not included in the mask, the user will be warned by an alert dialog (the user has the ability to opt not to be warned again).
getFolderChildren is a boolean. Set to true, it will return the first level children of any selected folder. The concept is that if a user selects a folder in bridge, they can operate the files in that folder. It defaults to true.
filesOnly is a boolean. Set to true, it will return only files, no folders. It defaults to false.
firstOnly is a boolean. Set to true, it returns only the first valid file found. This is useful when you are attempting to do an example of the result of one of the selected files. It defaults to false.
One more thing: If the user has a document open in bridge, but has not selected anything, it will assume the entire contents of the document are desired. It will flip up a warning dialog if this is the case (the user can opt to not be warned again).
We also extended the File Object in bridge (not the point apps) to do the file filtering for us. Part of that was the creation of a number of standard masks.
TYPES.PHOTOSHOP
TYPES.PHOTOSHOP_OPENABLE
etc.
var thumbs = getBridgeThumbnails( TYPES.PHOTOSHOP_OPENABLE, true, true );
for ( var i = 0; i < thumbs.length; i++ ) {
thumb = thumbs[ i ];
// do something with the selected thumbnail
}
The libraries are AdobeLibrary1.jsx and AdobeLibrary2.jsx. There is an AdobeLibrary3.jsx, but it's primarily patches for the other two.
Over the next few weeks, I am going to post some messages about those libraries to help get folks started bridge scripting.
First up are some file handling utilities.
getBridgeThumbnails and getBridgeFiles are two library functions that return the selected (in Bridge) Thumbnail objects or File objects. getBridgeFiles takes the output from getBridgeThumbnails and converts them to File objects. These functions also ensure that any Version Cue files that were selected are up to date on the local file system prior to returning the selected objects.
The definition is:
getBridgeThumbnails = function( mask, getFolderChildren, filesOnly, firstOnly )
Where:
mask is a comma delimited list of file extensions or Mac file type strings. The function will only return Thumbnails that point to files of these types. It defaults to no mask, which will return everything. If the user selected Thumbnails that are not included in the mask, the user will be warned by an alert dialog (the user has the ability to opt not to be warned again).
getFolderChildren is a boolean. Set to true, it will return the first level children of any selected folder. The concept is that if a user selects a folder in bridge, they can operate the files in that folder. It defaults to true.
filesOnly is a boolean. Set to true, it will return only files, no folders. It defaults to false.
firstOnly is a boolean. Set to true, it returns only the first valid file found. This is useful when you are attempting to do an example of the result of one of the selected files. It defaults to false.
One more thing: If the user has a document open in bridge, but has not selected anything, it will assume the entire contents of the document are desired. It will flip up a warning dialog if this is the case (the user can opt to not be warned again).
We also extended the File Object in bridge (not the point apps) to do the file filtering for us. Part of that was the creation of a number of standard masks.
TYPES.PHOTOSHOP
TYPES.PHOTOSHOP_OPENABLE
etc.
var thumbs = getBridgeThumbnails( TYPES.PHOTOSHOP_OPENABLE, true, true );
for ( var i = 0; i < thumbs.length; i++ ) {
thumb = thumbs[ i ];
// do something with the selected thumbnail
}
