jscript FolderExists only go one level and alternative to ActiveX control - InfoPath Dev
in

InfoPath Dev

jscript FolderExists only go one level and alternative to ActiveX control

Last post 06-02-2008 07:15 AM by admot. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-30-2008 09:05 AM

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    jscript FolderExists only go one level and alternative to ActiveX control

    This is a two part question. I placed in the following code:
    function XDocument::OnLoad(eventObj)

    {

      var fso = new ActiveXObject("Scripting.FileSystemObject");

      var strRECFile = ("C:\\FolderOne");

      if (fso.FolderExists(strRECFile))

      {

         XDocument.UI.Alert("Folder Exists");

      }

      else

      {

         XDocument.UI.Alert("Folder doesn't exist");

      }

    }

     

    It finds the folder as expected. However, if I place in var strRECFile = ("C:\\FolderOne\FolderTwo"); it doesn't find the folder. I did a search but I couldn't find an example of a folder exists that found more than one level. Is my syntax incorrect? Can this method go more than one level?

     

    Question 2: The IE explorer's "ActiveX Page may be unsafe caution window appears". Is there anyway to disable it for this form itself? I don't want to soften the user's ActiveX settings in their IE. Is there an alternative to checking to see if a file exists other than the ActiveX?

     Thanks,

    Don't grow old regretting the things you didn't do.
  • 05-30-2008 01:42 PM In reply to

    • Albert
    • Top 500 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: jscript FolderExists only go one level and alternative to ActiveX control

    Did you use a double backslash between folders, like:

    var strRECFile = ("C:\\FolderOne\\FolderTwo");

  • 06-02-2008 07:15 AM In reply to

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Re: jscript FolderExists only go one level and alternative to ActiveX control

     

    Yep. That did it!

    I thought I tried that before and it didn't work. Seems to work now. I decided to use the FileExits and it works ok now as well.

    Thanks!

     

    BTW: I also figured out why the ActiveX popup appears. It's because I am in Preview Mode, which has limited trust. Since my template is Fully trused, the popup doesn't appear if I open the form directly.

    Don't grow old regretting the things you didn't do.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.