Assigning a new default TOC and then deleting the first TOC

In TCS2, this code that sets the second TOC as the default and then deletes the first TOC worked consistently.

if (RoboHelp.project.TOCManager.item(2).setAsDefault()) {



In TCS4, the same code sometimes crashed the script, so I had to add this code close and then reopen the project, and then check whether the TOC that I’m trying to delete is the default, before deleting the old TOC. I suspect inserting a delay would achieve the same thing – if you try it and it works, let me know.

if (RoboHelp.project.TOCManager.item(2).setAsDefault()) {

var projectName = fsName(RoboHelp.project.path) + “\\” + + “.xpj”;

if ( RoboHelp.project.TOCManager.item(1).name.indexOf(“Default”) == -1) {


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s