5 Replies Latest reply on May 26, 2014 6:22 AM by Rod@FOF

    member text with line numbers

    anjemalo Level 1


      Do you know how to write or add the line number inside a member text?

      I have some different word documents and I have to add the line number. I was trying with member("mytext").text.line, but when is a paragraph does not count, only detect RETURN between lines.

      Can you help me or guide me?

      many thanks

        • 1. Re: member text with line numbers
          Rod@FOF Level 1

          I could write a short routine that would solve this problem for you, but I am not sure the solution would be what you want. So, instead, I'm going to describe the logic of the problem. Then you can write your own solution, I can write a solution for you, or someone with even more knowledge can solve the problem for you!


          Anyway, here is how I see the problem.


          First, as you have described it, the text member contains text of a word document which includes returns between paragraphs and loooong lines of text where no return is present and the text wraps.


          However, if this is a word document, as described in the question, you know that your margin is set to a limited number of characters per line (with a type style and size specified).


          So, if you have a word document set to a specified font and number of characters per line, then numbers can be inserted at those points where the characters per line are reached (or exceeded). However, if the text flows free, say over several lines, then these numbers will not remain in a fixed position, so each time the character count for a line exceeds the specified character count, then a sequential number must be inserted at the front of the line and a return at the end of the line to set up the next line count evaluation.


          Of course, you would also want to take into account word breaks by using a word count check in conjunction with the character count line check. In some cases, when the line's word count length exceeded the word document character count length, then you would need rules to either split the word or move it to the next line, if this wasn't already established by hyphenation in your word document.


          To summarize in a generalized way, assuming a word document with a margin of 80 characters per line the following five steps would be used:


          Step 1: Write a routine that first gives you a Count = member(x).char.count.

          Step 2: Then, break the count into a loop that returns member(x).line[i].character.count.

          Step 3: When line[i].character chunks are less than or equal to 80 characters, then an incremented number and a space (in a repeat loop) is added to the front of each chunk. No return is added, because the line length already indicates a return is present.

          Step 4: When the line[i].character.count exceeds 80 characters, then the next incremented number and a space is added before character 1 of line[i] and a return is inserted after the 80th character (this could be fine tuned with a repeat loop that looked at words and spaces to keep it accurately aligned with the original document).

          Step 5: if member(x).line[i].count has more than 80 characters, the character counter is reset to 1, after it completes the process of adding a number in front of character 1 and return after character 80.

          Step 6: The process repeats in a loop through the count of all lines.

          Step 7: Rather than writing over the original member(x), this could all be written to a member(x2), thereby preserving the original document.


          Anyway, this summarizes a potential solution for a difficult problem. The fact is, using Director to count lines in a word document seems like a less than ideal use of Director. In fact, as I recall, word has a line numbering option built into it and time might be better spent determining how to export the document from word already numbered.





          • 2. Re: member text with line numbers
            anjemalo Level 1

            Is very complicated for a simple thing.

            Is possible to control (smooth scroll up and down) a external Word document from Director?

            Thank you very much for your support.

            • 3. Re: member text with line numbers
              Rod@FOF Level 1

              Yes, here is one solution that places the word document within the movie frame using activeX. http://www.fofcom.com/public/Embed_Word_Doc.zip This is easy to do, but it requires an additional Xtra. Unzip the Movie and Run it. Word docs are in the Docs folder. I've included the .Dir as well as the .exe for this.


              An easier method that will open the document in an external window use Buddy API, another Xtra. But if you only use a couple of the Buddy functions, it is free. The code for using it would be like this:


              OK = baOpenFile( the moviePath & "Your.doc" , "maximised" )


              See what you think.



              • 4. Re: member text with line numbers
                anjemalo Level 1

                When I execute ActiveX_loader1.exe and clilck button: Select Resource, two options appears, when I select the word document the FOF_Stand_Down_Text.doc, it open  in a new window out of Director.

                Do you know hot to solve this?


                Many many thanks

                • 5. Re: member text with line numbers
                  Rod@FOF Level 1

                  The movie uses ActiveX. ActiveX is primarily a Microsoft product.ActiveX opens a Microsoft Explorer Browser window in the Director movie. If it is opening "outside" the Director movie, then it is most likely due either to:  1) your installed browsers and how they are setup or 2) your system's ActiveX installation.


                  For this movie to work, you must have ActiveX installed on your system. Here is a link that can help you with that: http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/how-do-i-install-active-x-co ntrol-on-my-computer/d0ac5061-da7a-41cb-a47d-3487dd268317


                  You will also need Internet Explorer installed. It doesn't have to be your primary browser, it just must exist. You may also need to check how your Explorer setting are setup. If it is set so that things always open in a new window, then that would also explain the problem. Here is a link that discusses this issue. http://www.sevenforums.com/tutorials/14562-open-each-folder-same-own-separate-new-window.h tml


                  Beyond these two suggestions, I can't offer much. It works for me. And it is the only way I have found for directly opening Microsoft related products in Director.