Creating a new import project programmatically via API

This forum is for all Flare issues related to importing files or projects.

Creating a new import project programmatically via API

Postby NeilM75 on Tue Apr 27, 2021 2:57 pm

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!
NeilM75
Jr. Propeller Head
 
Posts: 2
Joined: Tue Apr 27, 2021 1:29 pm

Re: Creating a new import project programmatically via API

Postby robdocsmith on Tue Apr 27, 2021 4:16 pm

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-files-with-powershell/). 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
robdocsmith
Sr. Propeller Head
 
Posts: 130
Joined: Thu May 24, 2018 3:11 pm

Re: Creating a new import project programmatically via API

Postby NeilM75 on Fri May 07, 2021 6:37 am

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
NeilM75
Jr. Propeller Head
 
Posts: 2
Joined: Tue Apr 27, 2021 1:29 pm

Re: Creating a new import project programmatically via API

Postby robdocsmith on Sun May 09, 2021 9:17 pm

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
robdocsmith
Sr. Propeller Head
 
Posts: 130
Joined: Thu May 24, 2018 3:11 pm


Return to Importing

Who is online

Users browsing this forum: No registered users and 8 guests