Read the book!

XML Press has published MadCap Flare for Programmers: A guide to getting the most from Flare by Thomas Tregner and David Owens.

MadCap Flare for Programmers cover

I’m pretty excited about this. We cover the core subjects of this blog, often in greater detail. Some of the examples will look familiar but with more background information and deeper explanations. Other examples are completely new. You can read the list of chapters at the book’s page at XML Press.

If you want a narrative to help you begin scripting, automating, or programming in the context of MadCap Flare, MadCap Flare for Programmers is your starting point.

Highlights

  • Flare projects, the key items in Flare projects, and the underlying markup
  • Generating content with code
  • JavaScript with Flare web outputs.
  • Flare plugins including a step-by-step Hello World walkthrough and more advanced examples
  • Code samples

16 comments

  1. Hi, I just listened to your MadCap webinar about the book. I thought I heard you talk about programmatically extracting various data from databases. Are there code samples, discussion about this in the book? thx

    1. Thanks for attending! There is a simple example in the book and this blog about reading data from a CSV file. But we don’t delve into specific scenarios for specific databases since there are already plenty of resources about how to connect to a database and retrieve data. For example if you were retrieving data from a SQL Server database for a Flare plugin, you could use a .NET technology such as Linq to SQL.

      https://msdn.microsoft.com/en-us/library/bb386976(v=vs.110).aspx

      However there are examples in the book about to place data already mapped into objects in a programming language such as Java or C# into Flare artifacts such as topics and TOCs.

      So we focused on the Flare-specific stuff in the book. But you could piece that together with something like the resource in the link for a solution. Every scenario is different.

      1. Dear Thomas Tregner,
        I have a couple of questions about the build process of Madcap flare.
        – We have multiple projects created in Flare and each project contains a couple of flare batch files containing around 15 targets each. We have bound all those projects to Source control, TFS.
        Daily in the evening/night, we build&publish all these batch files from all these projects by running Powershell scripts with the providing madbuild.exe commands.
        During a build sometimes things go wrong in one of the projects:
        A batch file doesn’t start, that means the target isn’t build, and there is no logfile of this target with errors /explanations. Because one of the first things that happens during a build is the Get latest from Source I guess the build got stuck there. Is there a setting in Flare, that does try 1minute to do a get latest and if it fails, it will just quit? If so can we change this settings to 15min or to skip the get latest for this target and build the next target of the batch? If it is a corrupted file that causes the build not to start, can this file just be ignored for a build?
        When flare topics contain a html-error (for instance a missing span tag in a topic), we can find this info in the mclog file and the topic has got the read-only flag as a result in the publication folder when the project is build. My powershell script detects this and undo the read-only flag so it sends a not-readonly file to our website. This is not the ideal way, is there a way to let the build skip this file?
        Also about this, I have even seen an example of a message in Flare during build that prompted “ System.OutOfMemoryException” caused by one file with an html error. The Only way to make a successful build was to correct this one file. Is there a way to succeed with the build even though a file is corrupt?
        Right now I have a picture in one of the flare projects with the property file , both bind to source control:
        User_menu.png and user_menu.png.props. This user_menu.png got the read-only flag during buildtime, how does that happen?
        Thanks in advance,
        Koen Remmerswaal

  2. I bought your book after attending the MadCap webinar and read it cover-to-cover yesterday. Good work! Chapter 10, Flare Application and Flare Plugins, was worth the price of the book. Although my day job is to document software using Flare, I’ve been actively studying C# and looking for project ideas to improve my coding skills. My head just about exploded when I learned that I could BOTH improve my Flare skills AND practice C# coding by writing plugins. Once I finish writing this comment, I’m going to start scouring the Web for additional code examples of Flare V10 plugins in C#. Any suggestions where to go? Thanks again,
    Matt

    1. Thanks for reading! I haven’t run across any plugin resources other than MacCap’s API documentation and the plugin posts on this blog. If you find more, please let me know and I’ll link to those here.

  3. I’m a newbie with C#, so please forgive me. As stated on page 118, paragraph 4, “You can specify that selection text be replaced…” I’m trying to make a simple modification to the PluginApiDetails program to use ReplaceText(string) from the ISelection interface. I’m sure it’s easy, but I can’t figure out how to make it work! The subsequent example in the book, OpenDocumentPlugin doesn’t seem to actually change anything in the document, and the last example, InsertElementPlugin, does make a change to the document, but the DOM node stuff is frankly beyond my skill levels to comprehend.
    Can you update the PluginApiDetails example to actually make a change to the document, perhaps using the ReplaceText command? I really need to see how to hook back into the active document. Thanks!!

    1. The CodePastePlugin manipulates the elects in the active document. But updating the PluginApiDetails plugin is a good idea. I’ll put that on the list.

  4. Thanks, I’m looking forward to it. I can clearly see in the Details example how to display data about the Flare document in a Windows form, I just can’t figure out the reverse: how to get that form to make changes to the Flare document. Sorry to bombard you with this stuff–I’d never have gotten this far without your book, so hopefully you take my questions as a compliment.

    1. Thanks for reading! There is an example on pages 128 and 129 of the print version in the Formatting and Pasting Code Samples into Flare chapter.

  5. I figured out my novice programming mistake–I didn’t account for encapsulation. You can’t make calls to the plugin API from anywhere in the code, for example, by calling ReplaceText() from a Button_Click method in the form. Duh. Instead, you have to make the ReplaceText() call from within in the same method as the “IDocument activeDocument” and “ISelection selection” objects. I got it working!

  6. Hi Thomas – you will recall I had implemented my plugin based on your original forum articles and I had tried to update it to the v10 format you have in your book. I have a few issues and would appreciate your feedback.
    I have the reference to CanExecuteChanged as “public event EventHandler CanExecuteChanged;”, however the compile issues a warning re this as ‘undefined’.

    Also you show adding a toolbar button as ‘toolbar.AddButton(“Test”, new ButtonCommand(mEditorContext));’ whereas the format I have had to use is ‘toolBar.AddButton(“Test”, new ButtonCommand(mEditorContext, “tagset”));’ – not sure why the call without the second parameter does not work.

    Finally, I can get a reference to my active document with’IDocument activeDocument = pEditorContext.GetActiveDocument();’, and then and then get its url with’sourceUrl = activeDocument.GetSourceUrl();’, however I want to get the path to my project without having to first select a topic and in that case ‘GetActiveDocument’ returns a null. My reading of the API suggests I can’t do what I want but I perhaps there is a way?
    Thanks.

  7. Hello,

    Not sure if this is the right place to ask, but I’m doing a combination of LinkedIn conversation and Googling and came across your book.
    Does this book address what is needed to created user-driven, on-demand publishing? We are looking at providing users ability to create their own installation guides/manuals based on their model and options.

    We are using Flare, but are not overly structured with out authoring.

    My conversation on LinkedIn mentioned this could be done with Flare and javascript, but that is as much as I know right now. I am a technical writer/illustrator, not a coder, but I can understand what to ask 😉

    Thanks!
    Matt

    1. I don’t think you will get what you want from the book. It can help you with understanding how to integrate that sort of thing with Flare projects. Have you looked at MadCap Pulse?

  8. I am trying to load the CodePastePlugin example into my Flare 2017 r3. The plug in does not show up in the File> Options > Plugin editor. I have tried contacting MadCap, but they say there must be an issue with the plugin. Other plugins work. Is there a change I need to add to the plugin to make it work?

Leave a comment

Your email address will not be published.

HTML tags are not allowed.

253,249 Spambots Blocked by Simple Comments