loading
 
Set Array variable
Anonymous
11 year
I'm very new to VBScript and coding in general and am picking it up as I go along.
I have a script running to find the MAX_X position of various blobs

    list = GetArrayVariable("MAX_X")

    if isArray(list) then

    for i=0 to ubound(list) step (1)
    write "" & list(i)  & vbCRLF
    edge = list(i)        
    next

    End if

SetVariable "edge" &(i) , edge

In the Message box below my script I'm getting the values I need e.g.

Running . . .
236
420
116


This will only display the varialbe of the last MAX_X in the array in this case "edge3 116". I would like RR to assign a variable to all the MAX_X in the array.

I would also like RR to assign a seperate variable to whatever the lowest MAX_X number regardless of the other ones. In this case 116

Thanks
Steven Gentner from United States  [1446 posts] 11 year
Perhaps try

list = GetArrayVariable("MAX_X")

lowest = list(0)

if isArray(list) then
  for i=0 to ubound(list)
    write "" & list(i)  & vbCRLF
    SetVariable "edge" &i , list(i)
    if list(i) < lowest then
      lowest = list(i)
    end if
  next
end if

write "lowest max_x is " & lowest  & vbCRLF

STeven.
Anonymous 11 year
Top Banana. That worked a treat

Thanks for the help

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index