Creating a new import project programmatically via API

This forum is for all Flare issues related to importing files or projects.
Post Reply
NeilM75
Jr. Propeller Head
Posts: 2
Joined: Tue Apr 27, 2021 1:29 pm

Creating a new import project programmatically via API

Post by NeilM75 »

Hello

I am close to implementing an automated API/REST/TypeScript -> Flare project, but I am missing one final piece: is it possible to automate the Create-By-Import functionality? Specifically, I want to automate the steps to create a new project by importing a .chm file (this content describes the equivalent manual steps: https://help.madcapsoftware.com/flare20 ... -Files.htm).

The Flare API documentation only talks about creating plug-ins, which is not what I'm after. I would like to create a new Flare project and import a particular .chm file using straightforward import options, all programmatically. (Eventually, I will do a runtime merge of the created Flare project into an existing Flare project. Unfortunately, none of the standard TOC runtime merge options work for me, since I am importing a .chm created in DocumentX and outputting HTML5 from Flare.)

Any tips would be most welcome!
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Creating a new import project programmatically via API

Post by robdocsmith »

I don't think I can help you directly, but might give you some ideas to explore. Apologies if I've misunderstood the question...

A bit of background... I create Owner's Manuals for a luxury boat manufacturer and as such, I effectively build a new manual for each boat (each boat has many unique options and combinations of equipment). I have a Flare project that holds the majority of my content with many conditions. I also programmatically create content from various sources and convert them into topics and TOC entries that are then included in the Flare project and built into my output. I use Python to run my build process. When I build a new book my script:
  • scans internal and external webpages and spreadsheets for data and converts elements of those into topics, variables and conditions
  • scans PDF drawings, extracts and resizes those into topics and a Flare TOC file (a link to the TOC is already included in my Master TOC file).
  • creates new targets for the boat's book specifying the appropriate conditions and variables
  • builds the new book, does some post processing on the PDF and then publishes the book to my print server
I run my process from outside of Flare (only using Flare to edit main content), using the command line interface to build my books. A job that took days of copy paste in InDesign now takes roughly 2 minutes, and most of that is due to having to access various websites for data.

So in your case, I can conceive that you could write a script either run as a pre-build command or from outside of Flare that could extract content from a chm, process it to a suitable format and merge it into your project source ready for a build. HH.exe, for example, can decompile a CHM into a destination folder (-decompile $Destination $Filename - see a powershell script to do that at https://ridicurious.com/2016/07/07/chm- ... owershell/). Naturally, if you have access to the CHM source you can save the hassle of decompilation and reprocessing.

If you processed extracted html files into your required format and programmatically built a TOC, you could then copy content and TOC into your project. With the included newly created TOC linked from your master TOC, you can build the whole project into an integrated help system.

Rob
NeilM75
Jr. Propeller Head
Posts: 2
Joined: Tue Apr 27, 2021 1:29 pm

Re: Creating a new import project programmatically via API

Post by NeilM75 »

Thank you for the reply, Rob, Your solution is very elegant and the content you generate seems really interesting!
It's not quite what I'm after, since I want to automate the generation of the TOC by importing the chm file (this is a one-time import at project creation time, Flare doesn't support runtime merge of a chm built by another doc tool). I could hack around the initial project creation by just copying an empty Flare project, and then editing the copied project's content and project files as necessary. I have the chm and could set the other tool (DocumentX) to output to HTML. I suspect the solution will be to copy HTML output from DocumentX, edit/move the htm files as necessary to make them usable by Flare, and then generate the Flare TOC by inspecting the HTML folder structure. Not ideal since I'm essentially having to manually script what Flare does automatically when it creates a project by importing a .chm, but I guess it could work.

Thank you for the pointers and the ideas!

Neil
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Creating a new import project programmatically via API

Post by robdocsmith »

No worries Neil,

The layouts of Flare TOC and other structure files is fairly easy to duplicate and even if it's a one/off process per import, a little script to harvest a TOC from the CHM and turn it into an fltoc could be fairly easy to put together. I'm no programmer by any means and it depends on your script-comfort level. Hope you find the solution you need.

Cheers,

Rob
Post Reply