Set Array variable
4 years
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)        

    End if

SetVariable "edge" &(i) , edge

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

Running . . .

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

Steven Gentner from United States  [1370 posts] 4 years
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
end if

write "lowest max_x is " & lowest  & vbCRLF

Anonymous 4 years
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