Skip to main content
Inspiring
Jan 17, 2019 12:30 PM UTC
Question

How to fill SearchCondition arguments ?

Hi,

i'm trying to script the creation of a smart collection. But when it comes to SearchCondition object (SearchCondition(searchField, operatorType, operand)), i can't find any example of the searchField argument... I would like, for example, to specify criterias based on file name and metadatas...

Has anyone managed to script smart collections creation, and can explain it to me ?

Here is my work-in-progress script :

var myDoc=app.document;

var myScope=myDoc.visibleThumbnails[0].parent;

var whatToSearch='aString';

var searchParam01=new SearchCondition(WHAT_AM_i_ISUPPOSED_TO_WRITE_HERE, 'startsWith', whatToSearch);

var searchParam02=new SearchCondition(WHAT_AM_i_ISUPPOSED_TO_WRITE_HERE, 'contains', whatToSearch);

var mySearchSpec=new SearchSpecification ([searchParam01,searchParam02], 'or',100);

var thb_searchByRef=app.createSmartCollection ('searchByRef',myScope, mySearchSpec);

app.document.thumbnail=thb_searchByRef;

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Legend
    Jan 17, 2019 1:59 PM UTC

    Have you looked at the ESTK SDK? There are numerous sample scripts for custom searches that should have an example.

    Translate
    DuradAuthor
    Inspiring
    Jan 21, 2019 9:44 AM UTC

    Indeed, there is a search script sample in Bridge SDK. Unfortunately, it uses the Find dialog to set SearchCondition objects, while i'm trying to figure out how to set it by code.

    The reference manual tells us :

    SearchCondition Object : Defines a specific condition that must be met for a handled node to

    match a search. Returned from a selection in the Find dialog.

    SearchCriteria Object : Defines one possible search criterion for a search among handled

    nodes. Passed to Adobe Bridge to populate the Find dialog.

    Maybe there's something to do with SearchCriteria in the first place, pass it to Find dialog...

    Then, i might be able to use the "Find dialog" without actually displaying it ?

    Translate
    Participant
    Sep 16, 2020 1:00 AM UTC

    Up

    Translate