Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - array

Reply
 
Old 10-15-2008   #1 (permalink)
yqyq22


 
 

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
Old 10-15-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: array


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

> 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
Old 10-15-2008   #3 (permalink)
yqyq22


 
 

Re: array

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

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

> > 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
>
Quote:

> > 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
Old 10-15-2008   #4 (permalink)
Al Dunbar


 
 

Re: array


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

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

>> 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
Reply

Thread Tools


Similar Threads
Thread Forum
Fast copy method of sub array (=array range) possible? VB Script
How to create array without quotes? $array = (a,b,c) PowerShell
Array indexing: Want to say "Item #2 through the rest of the array." PowerShell
Stupid Array Tricks: Initializing an Array to a Certain Size PowerShell
how to assign values to array and how to create array via variable PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46