Once you’ve written your help file or documentation web-site, you’d usually like to be able to integrate it with your existing products: when users are having difficulties performing an action, they should be able to launch the help file and be presented with the correct associated topic explaining that specific action. For that purpose, Help Authoring Tools such as HelpNDoc provide two unique identifiers for each topic: an alpha-numeric Help ID and a numeric Help Context number. This makes it possible to reach a specific topic from your software application or web-site. But as a technical writer, you probably won’t be in charge of “wiring” that application or web-site with the help file and you’d rather send a list of topic identifiers to the developers in charge. Thanks to HelpNDoc’s very powerful script editor, you can easily do that!

Use HelpNDoc’s API to automate that job

HelpNDoc includes a very powerful API which can be used from the Script Editor to maintain and automate your projects. We will use it to create a file with a list of topic identifiers.

Use HelpNDoc's script editor to export topic identifiers

Once you’ve opened your project, you can access HelpNDoc’s Script Editor from the “Tools” ribbon tab. The script editor will be used to input and execute pascal-based code to automate the generation of a text file containing a list of topic captions as well as their associated Help ID and Help Context numbers.
If you are not a developer, do not worry: just copy and past the following script, then hit “Run script” in HelpNDoc’s script editor to automatically generate that text file.

const
  // Define the output file
  OUTPUT_FILE = 'c:\tmp\topics.txt';

var
  // Current topic ID
  aTopicId: string;
var
  // List of output
  aList: TStringList;

begin
  // Init list
  aList := TStringList.Create;
  aList.Add('Topic Caption | Help ID | Help Context');
  aList.Add('--------------------------------------');
  try
    // Get first topic
    aTopicId := HndTopics.GetTopicFirst();
    // Loop through all topics
    while aTopicId <> '' do
    begin
      // Add the topic to the list
      aList.Add(Format('%s | %s | %d', [
        HndTopics.GetTopicCaption(aTopicId),
        HndTopics.GetTopicHelpId(aTopicId),
        HndTopics.GetTopicHelpContext(aTopicId)
      ]));
      // Get next topic
      aTopicId := HndTopics.GetTopicNext(aTopicId);
    end;
    // Create the file
    aList.SaveToFile(OUTPUT_FILE);
  finally
    aList.Free;
  end;
end.

By running this script, HelpNDoc will generate a file located at “c:\tmp\topics.txt” (this can be customized in the script above) with a list of all the topics available in the current project. You can now send that file to your developers so that they can wire the application or web-site with the help file you are currently writing. This way, you won’t have to do the developer’s job and the developer won’t need to have to access the help file’s structure. Here is a sample generated text file:

Topic Caption | Help ID | Help Context
--------------------------------------
Introduction | Introduction | 0
Welcome | Welcome | 1
What's new | Whatsnew | 2
Getting Started | GettingStarted | 3
System requirements | Systemrequirements | 4
Getting help | Gettinghelp | 5

HelpNDoc’s API will help you save time

Thanks to HelpNDoc’s very powerful API and script editor, you will be able to quickly and easily achieve things which are impossible with any other Help Authoring Tools: Automate help and documentation generation, export topic identifiers, simplify time-consuming tasks… the possibilities are endless! So take a look at HelpNDoc’s huge list of available API methods and start automating your help, documentation and eBook writing now.

See also...

HelpNDoc's character analyzer illustration [illustration] [Featured]
Tech Writers' Secret Weapon: The Unique Advantages of Using HelpNDoc's Characters Analyzer

HelpNDoc has been a go-to solution for professionals seeking to create high-quality, engaging, and user-friendly documentation. However, it’s not just its user-friendly interface or its versatile …

Read More →
Happy technical writer using HelpNDoc [happy] [Featured]
Making the Most of HelpNDoc: How the "Keep Temporary Files" Feature Can Benefit Technical Writers

When working on technical documentation, every tool and feature at our disposal can make a big difference in productivity and efficiency. One such feature in HelpNDoc, often underutilized, is the …

Read More →
Converting Legacy WinHelp HLP to Modern Documentation [converting] [Featured]
Revitalize Your Help Files: Converting Legacy WinHelp HLP to Modern Documentation with HelpNDoc

In an age where information is consumed on a plethora of devices and platforms, the classic WinHelp HLP files — once the standard in Windows-based help documentation — are now relics of a bygone era. …

Read More →
HelpNDoc vs WordPress [versus] [Featured]
Mastering Multi-Channel Publishing: Why HelpNDoc Leaves WordPress in the Dust

In today’s interconnected digital world, the concept of multi-channel publishing has become more critical than ever. As audiences seek information through various platforms and formats, content …

Read More →

Categories: articles