Below is an example demonstrating how you can, using the relative path of a file on disk, retrieve information about the asset(s) that encapsulate that file, such as which product(s) that file is in and which categories it is assigned to.
// Define an anonymous function; // serves as our main loop, // limits the scope of variables (function( sRelativePath ){ // Get the asset manager var oAssetMgr = App.getAssetMgr(); // If the asset manager was not found, or we do not // have a database to retrieve information from if( !oAssetMgr || !oAssetMgr.haveDatabase() ){ // We are done... return; } // Declare working variables var oProduct, oAsset; var aAssets; var sFilePath; // Get the product(s) that the file is in; // every file is in at least one product, // even if that is the LOCAL USER product var aProducts = oAssetMgr.findProductsForFile( sRelativePath ); // Iterate over the products found for( var i = 0, nProducts = aProducts.length; i < nProducts; i += 1 ){ // Get the 'current' product oProduct = aProducts[ i ]; // Report the name of the product print( "-----", oProduct.title, "-----" ); // Get the assets in the product aAssets = oProduct.getAssets(); // Iterate over the assets for( var j = 0, nAssets = aAssets.length; j < nAssets; j += 1 ){ // Get the 'current' asset oAsset = aAssets[ j ]; // Get the relative file path of the asset sFilePath = oAsset.getRelativeFilePath(); // If the path doesn't match the one we are looking for if( sFilePath != sRelativePath ){ // Next!! continue; } // Report various bits of information about the asset print( "Name:", oAsset.displayName ); print( "Categories:" ); print( " -", oAsset.categories.join( "\n - " ) ); } } // Finalize the function and invoke })( "People/Genesis 3 Female/Characters/Victoria 7.duf" );