Method to get and set the context sensitivity for a topic. This method is the equivalent of the function topicCSH()
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:
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 |
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 |
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] ); } } }