Forum Discussion

bduncan's avatar
bduncan
Contributor
9 years ago
Solved

Lost help file favorites

SmartBear's help file is not one of the easiest I've used when you are looking for information.  Thankfully they have a favorites tab that you can attach particularly difficult to find topics.   Th...
  • HKosova's avatar
    9 years ago

    Hi Bill,

     

    You are correct, CHM favorites are tied to the specific CHM file name and path. Windows stores information about all CHM files ever opened on a computer in the hh.dat file here:


    C:\Users\<username>\AppData\Roaming\Microsoft\HTML Help\hh.dat

     

    It's a binary file, so there's no out-of-the-box way to transfer favorites from one CHM file to another, but there's a workaround.


    You can see your favorites if you copy the TestComplete 11 help file to your previous TestComplete path, for example, to:

    <your old TC 10 folder>\Help\TestComplete10.chm
    and open this copy. You can then add the same favorites in the new help file. This can be automated using a TestComplete script like the one below. Before running this script, uncheck the Stop on Error option in Tools > Current Project Properties > Playback.

     

    // JScript
    function CopyFavorites() {
    // The CHM file with favorites var fileName1 = "C:\\Program Files (x86)\\SmartBear\\TestComplete 10\\Help\\TestComplete10.chm"; // The CHM file to copy favorites to
    var fileName2 = "C:\\Program Files (x86)\\SmartBear\\TestComplete 11\\Help\\TestComplete11.chm"; // Open the CHM file with favorites var navPane1 = OpenCHMAndGetNavPane(fileName1); var tabs1 = navPane1.Window("SysTabControl32"); tabs1.ClickTab("Favor&ites"); var favList1 = tabs1.Window("#32770").Window("SysListView32"); // Open the new CHM file var navPane2 = OpenCHMAndGetNavPane(fileName2); var tabs2 = navPane2.Window("SysTabControl32"); tabs2.ClickTab("Favor&ites"); var favList2 = tabs2.Window("#32770").Window("SysListView32"); tabs2.ClickTab("&Search"); var searchBar2 = navPane2.Window("Edit"); var btnSearch2 = navPane2.Window("Button", "&List Topics"); var searchResults2 = navPane2.Window("SysListView32", "HH FTSearch"); var btnAddFav2 = navPane2.Window("SysTabControl32").Window("#32770").Window("Button", "&Add"); // Copy favorites from one CHM to another for (var i = 0; i < favList1.wItemCount; i++) { var title = favList1.wItem(i); // Search for this topic in the new help file tabs2.ClickTab("&Search"); searchBar2.wText = title; btnSearch2.ClickButton(); // If the topic with the same title was found, add it to the target file if (searchResults2.wItem(title) != null) { searchResults2.DblClickItem(title); tabs2.ClickTab("Favor&ites"); btnAddFav2.ClickButton(); } else { Log.Warning(aqString.Format("Topic with title \"%s\" was not found.", title)); } } }

    function OpenCHMAndGetNavPane(strFileName)
    {
    var oShell = Sys.OleObject("WScript.Shell");
    oShell.Run(aqString.Quote(strFileName));
    Delay(1000);

    var p = Sys.FindChild("CommandLine", "*" + strFileName + "*");
    var navPane = p.Window("HH Parent").Window("HH Child", "", 2);
    return navPane;
    }

     

    Hope this helps!

     

    Alternatively, you may want to use the TestComplete online help, and use the browser bookmarks to keep track of the articles of interest.

  • HKosova's avatar
    HKosova
    9 years ago

    Why not create a temporary JScript project for this script, and delete it afterwards?