Forum Discussion

bduncan's avatar
bduncan
Contributor
10 years ago

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.

 

That's all well and good, however, on installing the new version of TestComplete 11, my favorites list is empty.  I'm assuming that because SmartBear installs new versions to separate directories, that is the reason for the loss.

 

It was hard enough the first time to find some of the items I saved as favorites, and I most certainly do not want to was more time doing something that I've already accomplished.  I didn't see any obvious files that might contain this information that I could copy from old to new version; is anyone aware of how to get these favorites back?

 

Thanks

Bill

  • 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.

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

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    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.

      • bduncan's avatar
        bduncan
        Contributor

        Sorry, I tried, unsuccessfully, to convert this to vbScript.  For now, I'm just living with it.