5 Replies Latest reply on Jun 25, 2012 1:50 PM by pthomas

    Passing HTML to VBS file

    pthomas

      Hello,

       

      I have been playing around with a VBS file as a method of getting around FileMakers limitation of not supporting HTML e-mails.

       

      Due to security restrictions enforced by our IT department I am not able to generate the VBS file dynamically out of FileMaker, our system administrator will only allow me to execute an existing VBS file that is set to read only.

       

      So I am looking at passing in various information (Subject, Body etc...) through script parameters and I have hit a bit of a snag.

      FileMaker seems to be having trouble passing through the HTML tags correctly.

       

      This is the command that I am using for my SendEvent step:

       

      "C:Program FilesFileMakerVBSEmail.vbs" "Subject Test" "<i>Is this thing on?</i><p>Yes</p>"

       

      And my VBS script then picks up two parameters:

       

      SendTo = Wscript.Arguments.Item(0)

      Subject = Wscript.Arguments.Item(1)

       

      If I set up a new shortcut on my computer using the above string it executes fine, however when I try to run this from FileMaker I get the the following error:

       

      Capture.PNG

       

      If I remove the / character out of the </i> and </b> tags then the script runs fine (although the formatting of the HTML is of course wrong) so it would seem that FileMaker is doing something funny with the / character...

       

      I tried escaping the / with a  but that didn't seem to work and as far as I know / should not need to be escaped anyway?

       

      In case it matters here is the full FileMaker script I am using:

       

      Capture.PNG

       

      And the VBS script:

       

      Capture.PNG

       

      Has anyone come across this before or can anyone think of another way for me to be able to get this working?

       

      Cheers,

       

      Paul.

        • 1. Re: Passing HTML to VBS file
          Malcolm

          This is the command that I am using for my SendEvent step:

          "C:\Program Files\FileMakerVBS\Email.vbs" "Subject Test" "Is this thing on?<p>Yes</p>"

           

          Heres the bad news. The forward slash character is already a well recognised symbol for a file system directory.

           

          malcolm

          • 2. Re: Passing HTML to VBS file
            pthomas

            Hi Malcolm,

             

            Not really sure what your point is sorry?

             

            The string is enclosed in quotes, so the forward slash shouldn't matter?

             

            As I mentioned, if I simply go to my desktop, create a new shortcut using the text string and then double click on the shortcut it works perfectly.

             

            It is only when FileMaker trys to execute the file that it fails.

            • 3. Re: Passing HTML to VBS file
              wimdecorte

              try starting your send event with: "cmd /c " and see if that solves it.

              Other than that: can you post what the data viewer reports as the content of your $File variable at runtime?

              • 4. Re: Passing HTML to VBS file
                pthomas

                Tried adding the "cmd /c" option both as:

                 

                "cmd /c C:\Program Files\FileMakerVBS\Email.vbs" "Subject Test" "<i>Is this thing on?</i><p>Yes</p>"

                 

                and

                 

                cmd /c "C:\Program Files\FileMakerVBS\Email.vbs" "Subject Test" "<i>Is this thing on?</i><p>Yes</p>"

                 

                No luck with either - I was unable to get either of the above options working via the Start - Run option in windows either, if I leave the cmd /c option off and just do a Start - Run on:

                 

                "C:\Program Files\FileMakerVBS\Email.vbs" "Subject Test" "<i>Is this thing on?</i><p>Yes</p>"

                 

                It works.

                 

                The above string is exactly how the $File variable looks just before it is used in the Send Event command:

                 

                Capture.PNG

                 

                If I copy and paste the command directly from the above window into Start - Run it works fine.

                 

                Cheers,

                 

                Paul.

                • 5. Re: Passing HTML to VBS file
                  pthomas

                  I have managed to get it working - I will mark this as the correct answer in case anyone else has a similar problem in the future.

                   

                  Instead of using the / character I instead substituted the numerical HTML code value of that character which is &#47;

                   

                  So my string now looks like this:

                   

                  "C:\Program Files\FileMakerVBS\Email.vbs"  "Subject Test" "<i>Is this thing on?<&#47;i><p>Yes<&#47;p>"