2 Replies Latest reply on Nov 20, 2009 10:59 AM by Head1

    A question about Include function

    Head1

      Hello everybody,

        In order to use  allready  written library functions, I have to use the function Include("some file").

        The problem is that it does not work.

        Btw: I do not rely on WDIR, but write the whole path to the  include instruction.

        My question: Is there anything else I have to write in the .vbs file in order to link

        to the library file? in book it is not so clear, or my English is weak..

       

                            Many thanks,

                                  Head1.

       

        

       

       

       

        • 1. Re: A question about Include function
          kendall_hiles

          Here is a version that does not look in the WDIR for you automatically

           

          ' Helper function for including script libraries.
          Sub Include(fileName)
              Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
             
              Const ForReading = 1
              Dim f: Set f = fso.OpenTextFile(fileName, ForReading)
              Dim s: s = f.ReadAll()
              ExecuteGlobal s

          End Sub

           

          -kendall

          • 2. Re: A question about Include function
            Head1

            Hello Kendall,

               Thanks for you answer,

                   I will check it . First thing tomorrow is building a modest library.

                    

                                Thank you.

                                    Head1.