Using Favorites with IMatch 2017

Started by Mario, April 28, 2017, 02:48:55 PM

Previous topic - Next topic

Mario

Similar to the 'commands' functionality, IMatch 2017 offers an endpoint which allows apps to retrieve all available Favorites. And another endpoint to execute a Favorite.

If you call the v1/imatch/favorites/list endpoint, IMatch returns a list of all Favorites. For each Favorite the unique id, the name, description, type and some other attributes are returned. For example:


{
     "id": "1904EE80-3BE4-40ED-A387-C07FA4DD5720",
      "type": "mdtemplate",
      "name": "Fix Broken Nikon Data",
      "description": "This metadata template performs some really cool data-bending.",
      "textColor": "#c3daed",
      "backgroundColor": "#0046ff"
}


This Favorite runs a Metadata Template that fixes some broken metadata. To run this Favorite from an app for the files currently selected in the file window, all you need to know is the "id". Then you use the IMatch.favoriteExecute method:


IMatch.favoriteExecute({
    guid: '1904EE80-3BE4-40ED-A387-C07FA4DD5720',
    op: 'primary',
    idlist: IMatch.idlist.fileWindowSelection
});


The method takes three parameters: The id of the Favorite to run, if you want to run the primary (left mouse button) or secondary (right mouse button) operation and the list of files to work on. You can specifiy individual file ids or you use one of the pre-defined lists. In this case we use the list that represents the files currently selected in the file window.

That's it. You now can run Metadata Templates, assign or un-assign batches of categories, trigger Design & Print Templates, Renamer Presets and more.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook