Re: Ruby and WMI

#Thank you, it now works, can you tell me one thing, ( I am learning)
#what does [8…-1] mean in the script “puts “\t” + mem.adsPath[8…-1]”.

hope this is simple enough.

C:\family\ruby>irb --simple-prompt

x=[0,1,2,3,4,5]
=> [0, 1, 2, 3, 4, 5]

here, we access normally the array x.
the first index starts at 0.

x[0…1]
=> [0, 1]

we access the third (3-1) and fifth element (5-1)

x[2…4]
=> [2, 3, 4]

to access the element relative to the last position, prefix the index
with a minus sign. But there is -0, so start w -1.

x[2…-1]
=> [2, 3, 4, 5]

x[2…-2]
=> [2, 3, 4]

it works too even if both are negative as long as start index is less
than or equal to ending index

x[-4…-1]
=> [2, 3, 4, 5]

x[-2…-1]
=> [4, 5]

x[-1…-1]
=> [5]

x[-4…-4]
=> [2]

otherwise, these will return empty arrays

x[-1…2]
=> []

x[-1…-5]
=> []

x[-1…-4]
=> []

hth.

kind regards -botp