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

Can the file browse scheme be modified?

New Here ,
Aug 20, 2005 Aug 20, 2005
I would like to create some new views in Bridge that don't show some files in a directory. In particular, one thing I'm trying to do is to create a view that only shows the latest versions in a directory (e.g. don't display originals when there is an edited derivative).

I've got all the script code that iterates through an existing view in Bridge and identifies which thumbs I want to keep and which ones I don't want displayed, but I can't figure out how to modify which thumbs are or are not displayed. Thumbs have a "hidden" property, but that is listed as readOnly and setting it to true does, indeed, not do anything.

I can't tell if a Browse Scheme is what I should be implementing or not. I want nearly all of the functionality of the existing file view so I'd hate to have to re-implement all of that in my own scheme. Is it possible to "hook" or "sub-class" the existing file view or file browse scheme so I can modify it slightly?

--John
TOPICS
Scripting
739
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
Community Beginner ,
Aug 20, 2005 Aug 20, 2005
John,

I believe a custom browse scheme is what is needed here. It is not possible (AFIK) to hook or sub-class an existing browse scheme.

I've never had the need (so far) in my bridge work to create a custom browse scheme, it's on my list of things to do.

As you get going on it, I'll provide you with whatever help I can. If I don't know the answers, I'll find them for you.

Bob
Adobe WAS Scripting
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 20, 2005 Aug 20, 2005
I'm confused about how a custom browse scheme lets me do what I want. (probably because I don't really understand what they are). I guess I'm in search of sample code for a browse scheme that does something real and non-trivial that I can study. I see code snippets where custom browse schemes add things to the favorites panel, but I have no need/interest in doing that. The file system stuff in the favorites panel is fine for my needs.

If I create a browse scheme and register it and put a top node into the favorites panel, how do I then control the view of files in the content pane the way I want. Are there events that I can intercept on my own browse scheme? Are there methods I supply somehow?

Are there any pieces of sample code that illustrate a non-trivial browse scheme? That shows different views of the file system than the default views?

--John
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
Community Beginner ,
Aug 21, 2005 Aug 21, 2005
John,

To my knowledge, there isn't a more complete example lying around.

I'll work one up and post it. Might take a few days for me to get up on the learning curve myself.

The app.registerBrowseScheme call takes the scheme name (something you make up) and a handler script function. While I've never done it, I would assume that the handler fires when a document using the scheme name opens.

I would assume that your handler function would create thumbnails and add them to the document. (but that's not firm knowledge on my part at this point).

There are a slew of document and thumbnail events as well.

Bob
Adobe WAS Scripting
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 21, 2005 Aug 21, 2005
I'll appreciate whatever help you can provide. It looks like there's some sort of callback through app.document.jsfuncs for a browse scheme, but the documentation seems pretty sketchy for how that all works and what events are present in that callback or need to be handled.

I'm hoping that I don't have to re-implement all the functions, views, right click menus, open commands, etc... on the file browsing scheme just so that I can add a few new views to what already exists for the existing scheme.

--John
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
Community Beginner ,
Aug 22, 2005 Aug 22, 2005
John

It doesn't look like it's possible to make a file system based custom browse scheme.

A thot I had was that you could hide the versions you didn't want to see. Catch the Document.open event, if it's attempting to open a single thumbnail, and that thumbnail is a container, you run throught the children of the thumbnail, hiding those you do not want shown.

files = thumb.spec.getFiles();
for ( var i = 0; i < files.length; i++ ) {
if ( shouldBeHidden( files[ i ] ) ) {
files[ i ].hidden = true;
else {
files[ i ].hidden = false;
}
}

You'll have to be careful about file system hidden files to make sure they aren't improperly un-hidden.

In your event handler, return { handled: false }, so that Bridge continues to process the event after you've hidden the files.

I do not how well this will work, but I think it might be worth a try.

Bob, hacking away.....
Adobe WAS Scripting
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 22, 2005 Aug 22, 2005
Your suggestion sort of works in that items do get removed from the content pane view, but it hides the file at the OS level, not just within bridge. In other words, it actually changes the file attribute on disk to "hidden" which is not something I can do or want to do.

I have found that the event.document.thumbnail.children array is fully populated when the "open" event is called for the master directory thumbnail and similarly it's possible to get the same array using the event.document.thumbnail.getFiles() function that you suggested. But, I haven't yet found a way to manipulate that array. I tried removing items from the array and they don't remove.

Rather than the spec.hidden field which actually changes the hidden attribute on disk, I wish I could write to the thumb.hidden attribute because that sounds more like a "view" attribute than a hard disk attribute. But, alas, that field is documented as read-only.

Any chance of finding a different way to manipulate the children array from the "open" event? That IS exactly what I need.

--John
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 22, 2005 Aug 22, 2005
OK, another question since I'm now pursuing a different tactic. If you are writing your own browse scheme that isn't intended to be either web or filesystem, but some other type of document, how do you do that?

I can get a shortcut for my browsescheme into the favorites panel and can get the open and loaded events when I click on it, but I don't know how to populate the children array to tell it what to display in the content pane? Again, the children arrays seem to be read-only so it won't let me write to them from either the open or loaded events. How are you supposed to populate the content pane when writing your own browse scheme? Do I have to populate the children arrays at a different time? from different events?

--John
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
Community Beginner ,
Aug 22, 2005 Aug 22, 2005
John,

I am trying to figure out a way to get this done for you. :0)

Probably won't be until tomorrow before I get back to you again.

As far as I know, there is no way to directly add or remove items from the children array.

Bob
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 22, 2005 Aug 22, 2005
OK, thanks for checking on this.

I see all this wonderful scriptability in Bridge and that your engineers clearly put a lot of thought and a lot of design effort into it and I just assumed that the whole point of this huge investment was to let us create new views in the content pane that supported a particular workflow. It seems like such an obvious application that I'm still believing that there must be a way to do it.

FWIW, I have created some useful functions already, but only things that manipulate the selected items in the content pane. I now have a menu item that will select all the latest versions in a directory and leave the originals or earlier versions unselected. This lets me easily make a selection of my latest versions and then run something like the Image Processor to create output based on my latest versions.

--John
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 22, 2005 Aug 22, 2005
Some related info. In trying to understand script-defined browse schemes, I copied this code directly from the Bridge Javascript Reference (changing paths and URLs to real ones in my system) and it does not quite work. Here's the code from pages 36-37.

// this is code copied directly from the documentation
app.registerBrowseScheme( "bank" );
var bankRoot = new Thumbnail( "bank://root", "My Bank" );
var transactions = new Thumbnail( "bank://transactions", "Transactions" );
bankRoot.displayPath = "http://www.google.com";
bankRoot.displayMode = "web";
transactions.displayPath = "/C/icons";
transactions.displayMode = "filesystem";
bankRoot.insert(transactions); //add thumbnail child
app.favorites.insert( bankRoot ); //add node
app.favorites.addChild( bankRoot, transactions ); // add subnode

I successfully get a new node in the favorites pane. Clicking on it shows the web page it's supposed to in the content pane and shows the sub-node in the favorites pane.

Clicking on the sub-node in the favorites pane, generates a script error somewhere off in stockphoto Javascript and, after ignoring that error in the debugger, the sub-node does not display the contents of the directory that it's supposed to.

In fact, looking at it in the debugger, Bridge thinks the sub-node thumb has a type of "other" which probably explains why it doesn't get any default file/directory behavior. The documentation on page 37 implies that it should inherit default file/directory behavior.

Still confused, but trying to provide helpful diagnostic info...

--John
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 23, 2005 Aug 23, 2005
I did finally get the sample code above to work by changing the file path from "/C/icons" to c:/icons - apparently the doc is just wrong. It still won't let me modify the children, so I still don't have a way to make custom views though.

I also found the code for the stock photos custom browse scheme on my hard disk. But, it's a pretty different animal (all web-based) so I don't think it will help me much.

--John
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
Community Beginner ,
Aug 23, 2005 Aug 23, 2005
John,

I'd like to see the code you have so far. With a chance to look at it, I might come up with a couple other weird ideas. Is there a web site I could download it from? Or could you send it (in-line in the message)?

rstucky@adobe.com

Thanks

Bob
Adobe WAS Scripting
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 23, 2005 Aug 23, 2005
LATEST
I'll send code samples and a summary of everything I've tried to your email address. It will take me a little while to recreate some of the things I've tried, but that is probably the clearest way to communicate what I'm trying to do and what I've tried so far.

In the process of trying to figure this out, I've learned Bridge event programming, custom browse schemes (which have immense promise, but don't actually seem very useful because they are so limited), the favorites pane, everything you ever wanted to know about the thumbnail and file class and a lot about how stock photos work (it's the biggest body of working code I can find for Bridge to study how to do things).

If I could ever figure out just this one thing (how to modify the content pane thumbnail array), I'm well equipped to write all the rest of my app now.

--John
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