Skip to main content
Participant
March 15, 2015
Question

How to create a book folder component?

  • March 15, 2015
  • 1 reply
  • 631 views

Hello,

I'm trying to create a book folder from a script. From what I understand the relevant methods are "NewSeriesObject" and "NewSeriesBookComponent"; they only take the object name. OK, so I create it and get what seems to be a file without a valid path. I then try to change the "ComponentType" property to "FV_BK_FOLDER", but cannot do it. If I try to change it directly, it just stays put; if I try to change it via "SetProps" the document simply disappears from the book.

The FDK has a sample of how to create a book component in C, but it creates a file, not a folder. Otherwise it seems to be as I described: first insert the component and then change it (the sample changes the name). The FDK reference doesn't describe the "ComponentType" property though.

Does anyone know how to create a folder?

Kind regards,

Mikhail

This topic has been closed for replies.

1 reply

Participant
March 15, 2015

A bit more about how I'm using "SetProps". First I tried to get all props with "GetProps", change the specific one, and then set them all with "SetProps". This doesn't work, the script says "timeout error". I then tried to construct just a single specific PropVal, then add it to PropVals object, and use this single value with "SetProps"; this doesn't work either, nothing happens.

Legend
March 16, 2015

Mikhail,

A very challenging question. So far, I can't figure it out. Like you, I see a new component created as a file, and any attempt to set FP_ComponentType has no effect. There is this function as well, that claims to insert a component of a certain type, but apparently only works for structured books:

  comp = book.NewBookComponentOfTypeInHierarchy (compName, compType, elemLoc);

I didn't try it.

One note about GetProps/SetProps... I often have trouble with those, especially when I attempt to tweak a property and reset. So, no surprise to hear of your trouble there. Normally, it is just better to set the property directly. That is, if it actually works.

I apologize that I don't have an answer for you. I'll keep thinking about it.

Russ

Participant
March 17, 2015

From what I understand, there's no way to change this property at all. It's probably set automatically. Here's what brought me to this conclusion: I decided to skip folders for now and started to add documents to the book and run into the same problem: I create a component and its ComponentType is set to (an undocumented) 512 and I cannot change it to, say, FV_BK_XML (0x20) But if I first make sure I have the document's file on disk and then create a component and set its Name to point to the file, I get the right FV_BK_XML type automatically.

The bad news is that, obviously, I cannot do the same for folders or groups as they are not mapped to filesystem objects.