User Tools

Site Tools


Sidebar

csh:csh

.CSH()

Method to get and set the context sensitivity for a topic. This method is the equivalent of the function topicCSH()

Usage

To get the topic ids and Map numbers assigned to a topic:

var tpmngr = currentProject.TopicManager;
for(var i = 1; i<=tpmngr.count; i++) {
  var topic = tpmngr.item(i);
  var topiccsh = topic.CSH();
}

To assign a topic id and a Map number to a topic:

topic.CSH("TopicId", 1);

To check that a topic has context sensitive help assigned:

var topiccsh = topic.CSH();
if(is_array(topiccsh)) {
  //Topic has CSH
} else {
  //Topic does not have CSH
}

Note:

  • When both the topic id and the Map number are not yet added to the project, the method will add the topic id and the Map number to the project.
  • When only the topic id or the Map number exist in the topic, the method cannot assign the CSH to the topic.
  • The method does not check whether the given topic id and map number are mapped to each other. The method assumed you created both ids correctly.

Parameters

Parameter Data type Required Description
topicid string The topic id to assign to the topic
mapnumber string/number Required when topicid is set The map number to assign to the topic

Return values

Value Meaning
array The context sensitivity of the topic
true Ids were assigned to the topic
false This topic has not context sensitivity OR could not assign context sensitivity to the topic

Structure of Returned Array

When the return value of the paragraph is false, there is no context sensitivity assigned to the topic. When there is context sensitivity assigned, an array with the following structure is returned:

- Numeric array key
|- CSHTopicidKey
|- CSHMapnumberKey

Each numeric key in the array is an embedded array. You use global variables to get the desired key:

Example:

var topicmgr = currentProject.TopicManager;//Load the TopicManager. currentProject is a variable from the library
 
for(var i = 1; i<=topicmgr.count; i++) {//Loop through all topics
 
    var topic = topicmgr.item(i);//Save the current topic to a variable for easy access
 
	//Get the required array with Topic CSH. This returns an array with the mapnumbers and topic id's that need to be set for the topid.
	var curTopicCSH = topic.CSH();
 
    if(is_array(curTopicCSH)) {//Is CSH assigned?
        for(var j=0;j<curTopicCSH.lengh;j++) {//Loop through CSH keys
 
            //Print to RoboHelp Output View Pod by using the library's msg function
            msg('Topic: '+topic.name+' ID:'+ curTopicCSH[j][CSHTopicidKey] +'#: '+curTopicCSH[j][CSHMapnumberKey] );
        }
    }
}
csh/csh.txt · Last modified: 2017/05/20 13:51 (external edit)