/ Forums / Advansys Formativ / Formativ Creator / Make some words bold before sending

  • Creator
    Topic
  • #3615
    xmart2k
    Participant

      Hello

      Can someone tell me how can I make a substring from BodyText, bold, before the email is sent?

      Thanks

    • Author
      Replies
    • #5646
      Support 3
      Participant

        See the following post, which shows how to change message body text to bold:

        http://www.advansyscorp.com/forums/topic/9061069751/

        Regards,
        Advansys Support

        #5643
        xmart2k
        Participant

          Thanks for the reply. I’ve read about tokens but I still can’t figure how to solve my problem which is:

          I have a list of words, I need to search the bodytext for that strings and when I find them I need to make them bold.

          I was thinking to parse the bodytext with the PosWordRight and SelectRightWord and when I find the words from my dictionary, make them bold. My problem is how do I know when PosWordRight arrives to the end of the message
          and how do I know who is the selected word. For the last issue I’ve tried the EnvTextCurrentWord token, but it returns only on letter, not the word.

          Thanks!

          #5645
          xmart2k
          Participant

            Other idea i had is to use the Find token, but using this is a little complicated, because I will need to use find for all the word, and if I have a big dictionary of words it will take too long. And I didn’t managed to make the findnext token to work properly. It pop-ups me the find dialog, not selecting the next occurrence from find

            #5647
            Support 3
            Participant

              You can also obtain an instance of the IHTMLDocument interface associated with the given window handle then update inner html.

              See IHTMLDocument2 interface for available members: http://msdn.microsoft.com/en-us/library/aa752574%28VS.85%29.aspx

              The code below access message body, set bold to some of the words.

                
                dim oList
                dim oDocument
              
                dim x
                dim text  
                dim innerHtml
                dim handle
              
                ' List of word to modify
                set oList = utilities.stringlist
                oList.add("Hello")
                oList.add("World")
                oList.add("Regards")
              
              
                set oDocument = nothing
              
                ' Get the message handle
                handle = Utilities.FindWindow("OFMailView", "")
              
                ' Get an instance of the IHTMLDocument interface
                if Utilities.IHTMLDocumentFromViewHandle(handle, oDocument) = 0 then
                  innerHtml = oDocument.body.innerHtml
              
                  for x = 0 to oList.Count - 1
                    text  = oList.Strings(x)
                    innerHtml = utilities.FastReplace(innerHtml, text, "<b>" & text & "</b>", false)
                  next
              
                  oDocument.body.innerHtml = innerHtml
                end if
              
                set oList = nothing
                set oDocument = nothing
              

              Hope this helps.

              Regards,
              Advansys Support

              #5642
              xmart2k
              Participant

                It worked!
                Thanks for the reply!

                #5644
                Support 3
                Participant

                  Great, thanks for letting us know and glad it was of assistance.

                  Regards,
                  Advansys Support

                Viewing 6 replies - 1 through 6 (of 6 total)
                • You must be logged in to reply to this topic.