12 Replies Latest reply on Sep 25, 2009 5:24 AM by Praful_Jain

    Here A Popup, There A Popup...

    MaritimeGirl Level 1

      I have thousands of topics and hundreds of them have multiple popups.  I compile, view a topic, click the link and the popup appears exactly where I expect it to appear, positionally based on the link I clicked.  I then open a different topic, click a link in the same spot (topics have the same look) but that popup appears in the top left corner of the topic.  This happens with all of the popups on the page.  I've checked dozens of topics and the vast majority of popups are appearing in the top left, nowhere close to the links from which they were triggered.

       

      I looked at the HTML to see if there was anything funky in there but the BSSCPopup calls are the same, except for the targets.

       

      Has anyone else has this problem with eHlpDhtm.js?  If so, what can I do to fix this problem?

        • 1. Re: Here A Popup, There A Popup...
          Willam van Weelden Adobe Community Professional & MVP

          Hi,

           

          Assuming you're using RoboHTML 8: Read this post and use the last ehlpdhtm from Praful Jain.

           

          Greet,

           

          Willam

          • 2. Re: Here A Popup, There A Popup...
            MaritimeGirl Level 1

            Hi, yes I am using 8.

             

            I tried the modified .js but the popup positioning did not change.  I looked at the changes made to it and they seem to only relate to scrolling behaviour, not coordinates.

            • 3. Re: Here A Popup, There A Popup...
              Willam van Weelden Adobe Community Professional & MVP

              In that case, the only things I can think of are updating the DHTML effects in topics if you're project was created in a previous version. If that doesn't work, you can also try and use the Robo 7 ehlpdhtm.js as long as it isn't fixed, but that's just a temporary workaround. I hope someone else has a better idea.

               

              Greet,

               

              Willam

              • 4. Re: Here A Popup, There A Popup...
                Praful_Jain Level 3

                Hi,

                Can you share a simple project where this issue is happening? Also you can zip the output folder and share it.

                 

                This will help root cause the issue.

                 

                -Praful

                • 5. Re: Here A Popup, There A Popup...
                  MaritimeGirl Level 1

                  After all that, the problem is not with the ehlpdhtm.js.

                   

                  It turns out that the difference between my topic that works and my topic that didn't work was an id tag on the href that had the BSSCPopup javascript in it.  Since we had thousands of files, we used macros to embed the javascript:BSSCPopup(' '); around all of the thousands of links.  Inside of RoboHelp, these popups appear in the CORRECT position, but once outside in the CHM or just directly accessing the .HTM files via IE, the popup will appear in the top left corner.

                   

                  Sure enough, when I opened the topic in RoboHelp, right-clicked on the incorrectly positioned popup link to look at the properties, touched NOTHING, closed the window, it so helpfully added the id tag it needed and now the popup appears in the correct position.

                   

                  My problem now is that I have thousands of files that do not have the id tags on the href links - I can't manually open every one and do that to every link.  So now, I'm going to have to write another macro to parse every file, counting the BSSCPopup instances as they go, embedding the id tag and then shoving this at the bottom before the closing body tag:

                   

                  <?rh-script_start ?><script type="text/javascript" language="JavaScript1.2">//<![CDATA[
                  if( typeof( FilePopupInit ) != 'function' ) FilePopupInit = new Function();
                  FilePopupInit('a1');
                  //]]></script><?rh-script_end ?>

                   

                  I think I need a drink.

                  • 6. Re: Here A Popup, There A Popup...
                    Praful_Jain Level 3

                    hi,

                     

                    Since you have told that the problem is ID are not generating, you have to add the IDs. the only way to add IDs is to write some program/script/macro to handle this.

                     

                    I have written a sample Script File, which will parse all the topics one by one and add ID and script tag at the end of the topic, if it finds popup tags without ID.

                     

                    I have uploaded the script file @ https://share.acrobat.com/adc/document.do?docid=57349a21-edfb-4b3a-8109-e3ce820f01f9

                     

                    You need to download this script file and import using the script manager pod.

                     

                     

                    Open the project and run this script file. THis will Update all the topics and add necessary ID and script in the topics.

                     

                    You need to have RoboHTML 8 to run script files.

                     

                    Hope this will help you.

                     

                    -Praful

                     

                    Please take a backup of the project, before running the script file.

                    • 7. Re: Here A Popup, There A Popup...
                      MaritimeGirl Level 1

                      Wow, thank you so much!  We tried accessing that url but it tells us we don't have permission to access it.  Is there somewhere else you can post it for me to grab?

                      • 8. Re: Here A Popup, There A Popup...
                        Jeff_Coatsworth Adobe Community Professional & MVP

                        MaritimeGirl - It looks like my first attempt didn't get through.

                         

                        I've downloaded it for you and tacked on a .txt extention to try and get it through the forum's filters. See if this worked. I think I'll also try pasting a plain text version of the script in this reply too.

                         

                        /***************************************************************************************** *******************
                        * $$FileName  Popup Fixer.jsx
                        *
                        * $$Description  Sample ExtendScript file to Add ID to the popup links
                        * This script will parse each topic to find any anchor tag, and see if the tag has  'javascript:bsscpopup(' or not
                        * if we find this string in href, then we see if there is an ID tag or not. if there is no ID tag, we create a new ID tag with name PopupID + count
                        * and in the end we add the script before the body end tag, and save the File
                        *
                        * Copyright (c) 2009 Adobe Systems Incorporated. All Rights Reserved.
                        ****************************************************************************************** *******************/

                        var topicmgr;
                        main();

                        function main()
                        {
                        msg('Starting THe Fixing Process');
                        topicmgr = RoboHelp.project.TopicManager;
                        ConvertAllPopups();
                        msg('Done with Fixing');
                        }

                        function ConvertAllPopups()
                        {
                        if(topicmgr.count>0)
                        {
                          var topic = topicmgr.item(1);
                          while(typeof(topic)!='undefined')
                          {
                           ConvertPopupInTopic(topic.path);
                           topic = topic.next;
                          }
                        }
                        }
                        function ConvertPopupInTopic(filepath)
                        {
                        msg('Parsing Topic '+filepath);
                        //we will create al popup ID with name PopupID+count
                        var stringToSearch = 'javascript:bsscpopup(';
                        var IDCount = 0;
                        var tokenmgr = RoboHelp.getTokenManager(filepath);
                        var bSave = false;

                        if(typeof(tokenmgr)!='undefined')
                        {
                          if(tokenmgr.count>0)
                          {
                           var token = tokenmgr.item(1);
                           while(typeof(token)!='undefined')
                           {
                            //check if it is text or not
                            if(token.tokenType == RoboHelp.TokenType.TOKENTAG && token.tagType == RoboHelp.TagType.TAGANCHOR)
                            {
                              //we need to find the href attribute and see if it contains  javascript:BSSCPopup(
                              var hrefString = token.getAttribute('href');
                              if(typeof(hrefString)==='string' && hrefString.length>0)
                              {
                               hrefString = hrefString.toLowerCase();
                               if(hrefString.indexOf(stringToSearch)!=-1)
                               {
                                //this is the token with popup link, we need to find the id attribute now
                                var popuplinkID = token.getAttribute('id');
                                if(typeof(popuplinkID)=='undefined' || popuplinkID.length==0)
                                {
                                 msg('Found popup Link Adding the ID now');
                                 //we found a link with no id
                                 //add a new ID
                                 IDCount++;
                                 var PopupID = 'PopupID'+IDCount;
                                 token.setAttribute('id',PopupID);
                                 bSave = true;
                                }
                               }
                              }
                            }
                           
                            //we need to find the body end tag as well
                            if(token.tokenType == RoboHelp.TokenType.TOKENTAG && bSave)
                            {
                             var tokenname = token.name;
                             tokenname = tokenname.toLowerCase();
                             if(tokenname=='</body>')
                             {
                              msg('Adding Script to the end of Body Tag');
                              //body end found
                              //we need to add the script now
                              var scriptToAdd = '<?rh-script_start ?><script type="text/javascript" language="JavaScript1.2">//<![CDATA[\n';
                              scriptToAdd+= 'if( typeof( FilePopupInit ) != \'function\' ) FilePopupInit = new Function();\n';
                              //we need to add all the popupinit now
                              var count=1;
                              while(count<=IDCount)
                              {
                               scriptToAdd += 'FilePopupInit(\''+'PopupID'+count +'\');\n';
                               count++;
                              }
                              scriptToAdd+= '//]]></script><?rh-script_end ?>';
                              //we have the script add to the end of body now
                              token.insertText(scriptToAdd,false); //we need to add before body end tag.
                             }
                            }
                            token = token.next;
                           }
                          }
                        }
                        else
                          alert('there is some error in getting the token manager');
                         
                        if(bSave)
                        {
                          msg('saving file '+filepath);
                          tokenmgr.save();
                        }
                        }
                        function msg(szString)
                        {
                        RoboHelp.project.outputMessage (szString);
                        RoboHelp.project.outputMessage ('\n');
                        }

                        • 9. Re: Here A Popup, There A Popup...
                          Jeff_Coatsworth Adobe Community Professional & MVP

                          Here it is - just strip off the .txt part. (Let's see if the attachment doesn't get stripped off this way)

                           

                          Jeff

                          • 10. Re: Here A Popup, There A Popup...
                            Praful_Jain Level 3

                            Thanks Jeff for the help,

                             

                            MaritimeGirl, Do let me know if you find some issues with the script file.

                             

                            Scripting is one of the many new powerful features incorporated in RoboHelp 8. With scripting, we can do many more thing, which were otherwise not possible or difficult to do.

                             

                            Please see the scripting Documentation help for more information about Scripting API @ http://help.adobe.com/en_US/RoboHelp/8.0/Scripting/robohelp_8_scripting.pdf

                             

                            -Praful

                            • 11. Re: Here A Popup, There A Popup...
                              MaritimeGirl Level 1

                              It looks like it worked perfectly!  If I had realized I could do this in RH scripting, I would have investigated doing it that way rather than via Excel macros which tended to be fairly slow. I know they would have ran a lot faster and I wouldn't have had to do so much manipulation, especially with my French language files.

                               

                              If I have to make any more global fixes, I'm definitely going to try the RH scripting first before I resort to VBA in Excel.

                               

                              Thank you!

                              • 12. Re: Here A Popup, There A Popup...
                                Praful_Jain Level 3

                                Nice to hear that the script solved the problem. Read the scripting documentation and try creating some sample scripts.

                                One thing, verify the scripts on some dummy projects, before using them to the main project.

                                 

                                 

                                -Praful