Skip to main content
Jacob_AA
Known Participant
October 31, 2018
Question

Does anybody know how to add group/folder with extend script

  • October 31, 2018
  • 2 replies
  • 2814 views

is it possible to add group/folder with extendscript ?

This topic has been closed for replies.

2 replies

Inspiring
October 31, 2018

Should work like this:

        var elemLoc = new ElementLoc() ;

        elemLoc.parent = this.book.HighestLevelElement  ;

        elemLoc.offset = 0;

        if (nextComponent.ObjectValid())

            elemLoc.child = nextComponent.ComponentElement;

        var newComponent = this.book.NewBookComponentOfTypeInHierarchy (folderName, Constants.FV_BK_FOLDER  , elemLoc);       

Same for groups.

Hope this helps

Markus

Legend
October 31, 2018

Well, I did see that, but I assumed the book was unstructured. I could not figure out how to do it without the structure-based methods. But now I play around with it a little more and I can't seem to even create an unstructured book (FM2015). So, are all books structured now?

Russ

Inspiring
October 31, 2018

Hi Russ,

I have to asked that question vice versa, have books ever been unstructured? :-)

No I'm not sure. That's part of a script I wrote for a customer which uses FM12/FM2015 in an unstructured environment, and that was the only way I was able to solve that problem.

And I think customer also works with unstructured FM variant and he never complaint.

But I think Folders and Groups are features which came with FM9. And perhaps starting from then books have this "XML"-logic.

Markus

Legend
October 31, 2018

Wow, that is a good question! I can't find anything in any documentation and I could not figure it out. I could insert a new file component with NewSeriesObject(), but could not convert it to a folder or group. It seems like ComponentType() is read-only. Maybe somebody else happens to know.

Russ