• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to read the CBTManager object

New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

I'm making a special extendscript for my Robohelp project.

And is is going well.

Only I can't seem to figure out how te read the CBTManager object.

I need the Conditional Build Tags in the current project to proceed, but I can't seem to get it to work.

I probably doing something wrong, and help is appreciated.

The documentation is saying this:

27-6-2011 11-58-07.png

So i tried the following:

   var CBT = RoboHelp.project.CBTManager;

   var CBTItem = CBT.item[0].name;

But all I get is [undefined].

CBTItem.count is returning 3 which is correct. My project has 3 CBT's defined.

But I want to know the names !!

The Documentation is saying the CBT has these properties, but I can't read them.

27-6-2011 12-02-13.png

Hope you can help!

Thanx

Ton Blokhuizen

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 27, 2011 Jun 27, 2011

Hey Ton,

       not to worry that much, you can show it up by copying the XML shared @ https://acrobat.com/#d=v9IuLeOs1mfFewrY6gcS7A and place it under the path "C:\Program Files\Common Files\Adobe\Scripting Dictionaries CS4\robohelp" and it will start showing up in the ESTK object model viewer if it is ESTK CS4 and if it is ESTK 5 then just change the name of the folder "Scripting Dictionaries CS4" to "Scripting Dictionaries CS5".

and in case you are using a 64 bit OS then place it under "Program

...

Votes

Translate

Translate
Engaged ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

The only problem is all the iterator in RoboHelp Scripting object model starts from 1 and not 0.

This is very much similar to Office macro support. so you should call

var CBTItem = CBT.item[1].name;

And it should work fine for you.

thanks

Praful

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hi,

The CBTManager starts counting at 1. A little counterintuitive, but a rule of thumb: When the object has a count method, start with 1. Regular arrays start with 0 as in normal JavaScript.

var CBTM = RoboHelp.project.CBTManager;

for(var i = 1; i<=CBTM.count; i++) {

     var CBT = CBTM.item(i);

     alert(CBT.name);

}

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Check!

I was confused by the zero and the use of brackets []

Now it is almost working.

var CBTList = new Array();

var CBT = RoboHelp.project.CBTManager;

for(var i = 1; i<=CBT.count; i++) {      CBTList = CBT.item(i).name }

This code is getting all of the available CBT inside the project and tha'ts ok.

Now I have to create a dialog like the "Define Conditional Build Tag Expression" so the user can apply the proper tags.

27-6-2011 12-47-06.png

I've seen some examples of creating a Dialog, so I thing I will be able to create one.

But, how do I pass this expression to the actual building process?

var outputssl = RoboHelp.SSLLayoutType.WEBHELPPRO

outputssl.generate();

is it as simple as:

var outputssl = RoboHelp.SSLLayoutType.WEBHELPPRO

outputssl.CBT = "NOT NEWTAG1 AND NOT Online"

?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Ok, This is the solution:

var sslmngr = RoboHelp.project.SSLManager; var outputssl = false;     for(var i = 1; i<=sslmngr.count; i++)      {           var ssl = sslmngr.item(i);           if(ssl.name == 'WebHelp Pro')           {                outputssl = ssl;                break;           }      } outputssl.CBT = 'NOT NEWTAG1'; outputssl.generate();

But, one last question:

Is it possible to read all the current projects properties?

In that case I would not have to create my own dialog, but just read the properties, including the CBT.

thanx

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hi,

What do you mean by "read all the current projects properties"? Do you want to show RoboHelp's own dialogs? I don't believe that's possible.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

No, I do not want to show the RoboHelp dialog.
I just want to read the projects properties.

To set the properties you only have to open the properties form like so:

1) Select "Webhelp (primary layout)" within the "Single Source Layouts" Pod window.

2) Right click on this node

3) Select Properties

The following form will be shown:

27-6-2011 14-22-01.png27-6-2011 14-22-11.png

I "just" want to be alble to read all of these properties in my script, eg the Conditional Build Tags expression

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hi Ton,

     Yes it is possible to read almost all the properties of any project please see the Object model viewer for RoboHelp 9 (for that you need to launch ESTK and then click Help->Object Model Viewer and then select RoboHelp object model).

I am attaching a screen shot which shows few properties

ProjectProperties.JPG

so you do have an option for accessing almost all the properties of any open project in RoboHelp

Hope this will help

Ashish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

I've lacked to mentioned that we're using RoboHelp 8.

Is the ESTK also available in RH 8? and if so, I've looked around, but can't find it.
Do I have to install it ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Definitly it comes with RH 8 too please check in the All programs list it is called "Adobe ExtendScript tool kit CS4" and if you cannot find it that means you might have not installed it while installed RH 8 so you will re run the installer and you will find the check box to install Extend script toolkit

Ashish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hmm... I'm feeling a bit stupid .....

This is the program I'n using all the time.

Your screen capure and the letters ESTK were making me confused...

I found it, but unfortunately I cannot select  "Robohelp"... only "ScriptUI Calsses" and "Core Javascript Classes"

27-6-2011 15-01-42.png

Do I have to make some kind of reference to Robohelp?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Check if you have the ESTK CS 4. The ROM is only available in ESTK CS 4. CS5 will not show it... You probably have some CS5 program installed along with RoboHelp 8.

The Object Model contains the same information as the scripting guide that Praful pointed out. The scripting guide also contains all objects, methods, properties etc. that you can access.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

That's bad news.

I've just updated the ESTK because the version shipped with RH8 was crashing all the time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hey Ton,

       not to worry that much, you can show it up by copying the XML shared @ https://acrobat.com/#d=v9IuLeOs1mfFewrY6gcS7A and place it under the path "C:\Program Files\Common Files\Adobe\Scripting Dictionaries CS4\robohelp" and it will start showing up in the ESTK object model viewer if it is ESTK CS4 and if it is ESTK 5 then just change the name of the folder "Scripting Dictionaries CS4" to "Scripting Dictionaries CS5".

and in case you are using a 64 bit OS then place it under "Program Files x86" in place of "Program Files"

Hope it will help

Ashish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

That's great Ashish! Thanks a bundle.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Super!

Thanx a lot......

Now it's time to figure out my actual problem of reading the project's properties.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

[see post below]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

Slowly I'm coming to my solution, but until then, I'm still struggling....

I've found some object(classes) in which CBT are stored :

28-6-2011 9-18-54.png

The CBT (top in list) seems the one to be!

But when i run my code, the result is "CBT is undefined"

28-6-2011 9-33-18.png

Strange because the intellisense is showing this:

28-6-2011 9-40-26.png

Anyway,

I can't seem to figure out which object to use to extract the Conditional Build Tag expression:

28-6-2011 9-43-50.png

I've also look inside the set of HTMLHelp.... objects, but could not find any CBT objects or strings.

28-6-2011 9-47-53.png

I want to thank you all for helping me so far, we are going in the right direction.

I did not come so far without all of your help!

and hope you can help me come to a solution.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

Hi,

The CBT is a sub class of the CBTManager. You cannot directly use this object. Instead you need to load a specific CBT using the CBTManager.

In post 4 you load all CBT's into a new array. That's the way to do it. For instance:

var C = new Array();

function start() {

     var CBTM = RoboHelp.project.CBTManager;

     for(var i = 1; i<= CBTM.count;i++) {

          C.push(CBTM.item(i));

     }

}

This willl load all the CBT into the variable C. Whenever you want to get details about the CBT in your project, you need to cycle through the array C.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

That's clear.

But how do i read the CBT expression filled out by the user?

28-6-2011 9-43-50.png

I need to do some filehandling depending on this expression.

In my case I need to generate a specific XSL file depending on the CBT.

The array contains all available CBT inside the project, but I need the CBT expression.

Greet,

Ton.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

Hi,

According to the scripting guide, you can get the CBT of the SSL using the CBT method:

1. First, determine the ssl to use and load that into a variable, for instance: ssl.

2. Then read the CBT from the ssl:

var myCBT = ssl.CBT;

You should then have the CBT string.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

Posting a sample which can do this

var MySSL = '' ;
var Layout= "WebHelp"
var project=RoboHelp.getCurrentProject();
var sslMgr=project.SSLManager;


for(var index=1;index<=sslMgr.count;index++)
{
  if (sslMgr.item(index).name == Layout)
  {
   var MySSL = sslMgr.item(index);
   break;
  }
}

alert(MySSL.CBT);

This can be used to alert the expression of the SSL with name WebHelp, Hope this will help

Regards

Ashish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

LATEST

I'm feeling really really stupid .....

I already had the code (see some posts back) to generate the project:

var sslmngr = RoboHelp.project.SSLManager; var outputssl = false;     for(var i = 1; i<=sslmngr.count; i++)      {           var ssl = sslmngr.item(i);           if(ssl.name == "WebHelp Pro")           {                outputssl = ssl;                break;           }      } outputssl.CBT = "NOT NEWTAG1"; outputssl.generate();

And instead of check if the CBT was already filled, I was focussing on filling it myself.

How stupid!

Thank you all for your help!

And my excuses for being so dumb!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp