Windows Vista Forums

array
  1. #1


    yqyq22 Guest

    array

    Hi all, i would like to optimize this code with a cicle, could someone
    help me please?
    Set server1 = CreateObject("WMSServer.Server", "server")
    Set server2 = CreateObject("WMSServer.Server", "server2")
    server1.PublishingPoints("Stress").stop
    server2.PublishingPoints("Stress").stop

    thanks a lot



      My System SpecsSystem Spec

  2. #2


    Pegasus \(MVP\) Guest

    Re: array


    <yqyq22@xxxxxx> wrote in message
    news:a690233b-4001-41d2-b8aa-4a6cbd8df473@xxxxxx

    > Hi all, i would like to optimize this code with a cicle, could someone
    > help me please?
    > Set server1 = CreateObject("WMSServer.Server", "server")
    > Set server2 = CreateObject("WMSServer.Server", "server2")
    > server1.PublishingPoints("Stress").stop
    > server2.PublishingPoints("Stress").stop
    >
    > thanks a lot
    Maybe a loop like the one below is what you're after. It will result in less
    verbose code but it won't speed up execution.

    aServers = Split("Server1 Server2 Server3 Server4")
    For i = 0 To UBound(aServers)
    Set oServer = CreateObject("WMSServer.Server", aServers(i))
    oServer.PublishingPoints("Stress").stop
    Next



      My System SpecsSystem Spec

  3. #3


    yqyq22 Guest

    Re: array

    On 15 Ott, 17:45, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:

    > <yqy...@xxxxxx> wrote in message
    >
    > news:a690233b-4001-41d2-b8aa-4a6cbd8df473@xxxxxx
    >

    > > Hi all, i would like to optimize this code with a cicle, could someone
    > > help me please?
    > > Set server1 = CreateObject("WMSServer.Server", "server")
    > > Set server2 = CreateObject("WMSServer.Server", "server2")
    > > server1.PublishingPoints("Stress").stop
    > > server2.PublishingPoints("Stress").stop
    >

    > > thanks a lot
    >
    > Maybe a loop like the one below is what you're after. It will result in less
    > verbose code but it won't speed up execution.
    >
    > aServers = Split("Server1 Server2 Server3 Server4")
    > For i = 0 To UBound(aServers)
    > *Set oServer = CreateObject("WMSServer.Server", aServers(i))
    > *oServer.PublishingPoints("Stress").stop
    > Next
    THANKS A LOT... is perfect...
    bye

      My System SpecsSystem Spec

  4. #4


    Al Dunbar Guest

    Re: array


    "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
    news:%23z5ia0tLJHA.728@xxxxxx

    >
    > <yqyq22@xxxxxx> wrote in message
    > news:a690233b-4001-41d2-b8aa-4a6cbd8df473@xxxxxx

    >> Hi all, i would like to optimize this code with a cicle, could someone
    >> help me please?
    >> Set server1 = CreateObject("WMSServer.Server", "server")
    >> Set server2 = CreateObject("WMSServer.Server", "server2")
    >> server1.PublishingPoints("Stress").stop
    >> server2.PublishingPoints("Stress").stop
    >>
    >> thanks a lot
    >
    > Maybe a loop like the one below is what you're after. It will result in
    > less verbose code but it won't speed up execution.
    >
    > aServers = Split("Server1 Server2 Server3 Server4")
    > For i = 0 To UBound(aServers)
    > Set oServer = CreateObject("WMSServer.Server", aServers(i))
    > oServer.PublishingPoints("Stress").stop
    > Next
    I find it marginally simpler to avoid indexing into the array with something
    like:

    aServers = Split("Server1 Server2 Server3 Server4")
    For each server in aServers
    Set oServer = CreateObject("WMSServer.Server", server)
    oServer.PublishingPoints("Stress").stop
    Next

    /Al



      My System SpecsSystem Spec

array problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast copy method of sub array (=array range) possible? Thomas Lebrecht VB Script 6 19 Mar 2009
How to create array without quotes? $array = (a,b,c) BenConrad PowerShell 5 04 Feb 2009
Array indexing: Want to say "Item #2 through the rest of the array." Kevin Buchan PowerShell 2 19 Dec 2008
Stupid Array Tricks: Initializing an Array to a Certain Size tojo2000 PowerShell 2 09 Sep 2008
how to assign values to array and how to create array via variable Frank PowerShell 1 13 Mar 2007