Skip to main content
Inspiring
January 17, 2019
Question

How to fill SearchCondition arguments ?

  • January 17, 2019
  • 1 reply
  • 326 views

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 has been closed for replies.

    1 reply

    Legend
    January 17, 2019

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

    DuradAuthor
    Inspiring
    January 21, 2019

    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 ?

    Participant
    September 16, 2020

    Up