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

Field or javascript variable to get robohelp project name at run time

Guest
Oct 12, 2010 Oct 12, 2010

Copy link to clipboard

Copied

Hi

We have a large number of projects and want a script that, when run from a topic (the user clicks some link), picks up the project name, in the same way for example that it can pick up the topic title by using the Javascript 'document.title' .

Thanks,

Peter B

Views

629

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

LEGEND , Oct 12, 2010 Oct 12, 2010

Hi,

To quickly get the project title, use top.document.title. This will only work if the entire skin is showing. When the skin is not showing, use show(); to open the skin.

Alternatively, the following (crude) function tries to retrieve the project title for you. It either returns the title or it returns false.

function GetProjectTitle() {
if(!isTopicOnly())
    var Title = top.document.title;
else
{
     if(gsStartPage.substr(0,4) == "file")
     {
         var Title = false;
     }
     else
     {
     

...

Votes

Translate

Translate
LEGEND ,
Oct 12, 2010 Oct 12, 2010

Copy link to clipboard

Copied

Hi Peter

I'm thinking the only way you can accomplish this is by populating the HTML of each topic with a JavaScript variable containing the Project Name. Then you would be able to read that variable and use it later.

Unfortunately, I don't believe there is anything in RoboHelp that will really assist much with this. So likely it will mean visiting each topic to insert the variable. I suppose you might be able to accomplish it fairly easily using a Find and Replace tool.

Cheers... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!

Adobe Certified RoboHelp HTML Training

SorcererStone Blog

RoboHelp eBooks

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 ,
Oct 12, 2010 Oct 12, 2010

Copy link to clipboard

Copied

Hi,

To quickly get the project title, use top.document.title. This will only work if the entire skin is showing. When the skin is not showing, use show(); to open the skin.

Alternatively, the following (crude) function tries to retrieve the project title for you. It either returns the title or it returns false.

function GetProjectTitle() {
if(!isTopicOnly())
    var Title = top.document.title;
else
{
     if(gsStartPage.substr(0,4) == "file")
     {
         var Title = false;
     }
     else
     {
        try {
            var sRelStartFile = _getRelativeFileName(document.location.href, gsStartPage);
           
            try {
                var oRequest = new XMLHttpRequest();
            }
            catch(e) {
                var oRequest=new ActiveXObject("Microsoft.XMLHTTP");
            }
           
            oRequest.open("GET",sRelStartFile,false);
            oRequest.send(null)
           
            var Content=oRequest.responseText;

            //Quickly split the text into arrays to get the title. No bothering with DOM.

            var beginTitle = /<title>/g;
            var endTitle = /<\/title>/g;
           
            var Title = Content.split(beginTitle);
            var Title = Title[1].split(endTitle);
            var Title = Title[0];
        }
        catch(e)
        {
            var Title = false;
        }
     }
}
return Title;
}

The function tries to get the content of the startpage from the server. This only works when your help is placed on a server. This function allways returns false when you call the help from a local disk.

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
Guest
Oct 13, 2010 Oct 13, 2010

Copy link to clipboard

Copied

LATEST

Neat and easy!

top.document.title gives me the project name and document.title gives the topic title.

Thanks,

Peter

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