[CC2018][Os X][JS] Place asset based on a script label
Hi,
With this post I would like to ask a question.
I have a library and I would like to place an asset on my document using the script label (not using the item name).
When looping the library assets, I'm not able to check the label. When checking the label contents, it always seems to be empty.
When placing the asset manually, the script label is filled in.
Is this a bug ?
Thanx
placeAsset();
function placeAsset(){
var myLib = app.libraries.item("myLibrary.indl");
var myItem = getItemFromLib(myLib, "import");
myItem.placeAsset(app.activeDocument);
}
function getItemFromLib(myLib, myLabel){
for(g = 0; g < myLib.assets.length; g++){
var myItem = myLib.assets
; if (myItem.label == myLabel){ // This doesn't work
return myItem;
}
}
}
