Copy link to clipboard
Copied
It should be simple, but I am going a bit crazy trying to work it out.
I have a Group (containing an image link and a text box - called myGroup) that I want to add as a graphic to a CC Library (which is called Profiles). I also have a text string (myText) that I want to use as the name for the asset.
Manually, this would be a drag and drop, but I have 600 of them to get through, so really need to script it.
This is how far I got|:
set myAsset = Application.Libraries.Item("Profiles").Assets.Add
which causes an error
Can anyone help with this.
Copy link to clipboard
Copied
Even if this would work you are not accessing CC Libraries with that code, but InDesign library files which is a totally different kind of library. I guess you have no InDesign library file open that is named "Profiles" and would show up as Profiles.indl file in the file system of your machine.
Regards,
Uwe
Copy link to clipboard
Copied
Sorry, my mistake. I was trying with cc Libraries, and it wasn't working.
I have now got an InDesign Library file open (Profiles.indl - saved in mydocs)
I've also tried using 'store' instead of 'add' as according to the API that is the appropriate function to use with regard to assets, but no luck yet.
Any ideas?
Copy link to clipboard
Copied
Hm. Cannot help much with VB scripting syntax.
Ok. I think you have to use "Profiles.indl" as string if you call the open library by name.
At least that will work with ExtendScript.
Regards,
Uwe
Copy link to clipboard
Copied
Well, I decided to leave VB script behind and move to Javascript. It seems its just better supported. Anyway, I got the script working,s o for anyone else who is struggling with this kind of thing, here it is:
var myDocument = app.documents.item(0);
var count = 0;
var i;
for (i = 0; i < 4; i++) {
var myGroup = myDocument.pages.item(count).groups.item(0);
var myText = myDocument.pages.item(count).groups.item(0).textFrames.item(0).paragraphs.item(0).contents;
var myLibrary = app.libraries.item("Profiles.indl")
myLibrary.store(myGroup, {name: myText});
count = count+1;
}
So, you'll need a library open, and in this case it's Profiles. The script takes the first group on each page and adds it to the library, with the name of the asset taken from the first paragraph of text in the group. It then loops through to the next page. (this one has 4 pages).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now