Announcement

Collapse
No announcement yet.

"Forking" in VBScripts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Forking" in VBScripts

    Hi all,

    I am planning on writing a simple automated task using vbscript to gather together some data for reports and send them off to various people.

    Now my question is - is it possible for the main script (let's call it report-main.vbs) to call a number of other scripts (let's call the other scripts adminreport.vbs, managerreport.vbs, userreport.vbs) at the same time to give a forking effect?

    Can this be done? Is it recommended? Pros and cons of doing something like this?

    (Please feel free to shoot me down on this one - I'll gladly provide the 12-guage shotgun with an extra load of buckshot for those with good reasons why not to do it )

    James

  • #2
    http://msdn.microsoft.com/library/de...l/wsmthrun.asp

    Why you could want not to use it ? You can't have checkpoints and semaphores and basically you have no control over the child scripts execution flow. No native way to synchronize the processes, but you can get away with doing logging by child processes to the file system and have the parent script looping and checking the execution status (from the logs) from time to time.

    But if you do not care about synchronization, this could indeed bea great boost to the execution speed when doing things like gethering inventory data from multiple remote computers.
    Guy Teverovsky
    "Smith & Wesson - the original point and click interface"

    Comment


    • #3
      Thanks for the link! Definitely a help.

      I'm still fairly new to VBScripting - what are checkpoints and semaphores? (I know its a different topic by hey! Might as well ask it now).

      Thanks for the note about no control over the child process(es) and lack of native synchronisation; I was guessing there may not have been any I was going to have to do something like you suggested with logging.

      Comment


      • #4
        Come to think of it - some opinions would be useful on this topic before I start the VBScripting project.

        May aim is to take a whole pile of data in a Microsoft Access database and dump it into a number of Excel spreadsheets (anywhere between 5 and 800 spreadsheets). (Data shaping already done and pre-prepared and can be ignored for the exercise)

        Now which would be better and/or faster method to do this? Using the VBA functionality built in to Microsoft Access? Or to use VBScript?

        Comment


        • #5
          Re: "Forking" in VBScripts

          Originally posted by JamesNesbitt
          Thanks for the link! Definitely a help.

          I'm still fairly new to VBScripting - what are checkpoints and semaphores? (I know its a different topic by hey! Might as well ask it now).

          Thanks for the note about no control over the child process(es) and lack of native synchronisation; I was guessing there may not have been any I was going to have to do something like you suggested with logging.
          Sempaphors (from wikipedia)

          Semaphores remain in common use in programming languages that do not intrinsically support other forms of synchronization. They are the primitive synchronization mechanism in many operating systems. The trend in programming language development, though, is towards more structured forms of synchronization like monitors and channels. In addition to their inadequacies in dealing with deadlocks, semaphores do not protect the programmer from the easy mistakes of taking a semaphore that is already held by the same process, and forgetting to release a semaphore that has been taken. Hoare, Hansen, Andrews, Wirth, and even Dijkstra have called semaphores obsolete.
          Checkpoint
          Guy Teverovsky
          "Smith & Wesson - the original point and click interface"

          Comment


          • #6
            Re: "Forking" in VBScripts

            Originally posted by JamesNesbitt
            May aim is to take a whole pile of data in a Microsoft Access database and dump it into a number of Excel spreadsheets (anywhere between 5 and 800 spreadsheets). (Data shaping already done and pre-prepared and can be ignored for the exercise)
            If I am not mistaken, ACCESS has a limitation of 10 concurent connections, so I'm not sure you'll have much luck when trying to spawn more than 10 processes.

            Originally posted by JamesNesbitt
            Now which would be better and/or faster method to do this? Using the VBA functionality built in to Microsoft Access? Or to use VBScript?
            Really not sure. What is the size of the Access DB ?
            I would only guess that VBA might have some internal optimizations, but on the other side, VBS would use probably the same COM interfaces. I guess that that if you want to spawn child processes, you might need to go the VBS route (not familiar enough with VBA), otherwise, pick your own poison
            Guy Teverovsky
            "Smith & Wesson - the original point and click interface"

            Comment


            • #7
              Re: "Forking" in VBScripts

              Originally posted by guyt
              Thanks very much!

              Comment


              • #8
                Re: "Forking" in VBScripts

                Originally posted by guyt
                If I am not mistaken, ACCESS has a limitation of 10 concurent connections, so I'm not sure you'll have much luck when trying to spawn more than 10 processes.
                Now I knew that there was a concurrent connections limit, didn't know it was so low, thanks for the number! Its definitely helpful.

                Not sure if I would want to spawn more than 10 at one time without degrading the performance for the other users on the server anyways.....


                Originally posted by guyt
                Really not sure. What is the size of the Access DB ?
                I would only guess that VBA might have some internal optimizations, but on the other side, VBS would use probably the same COM interfaces. I guess that that if you want to spawn child processes, you might need to go the VBS route (not familiar enough with VBA), otherwise, pick your own poison
                The size of the database is only about 4-5Mb.

                Thanks for the help, I'll play around with it in a test environment and see what I come up with.

                Comment

                Working...
                X