Как я могу получить содержимое из поля прокрутки и поместить его в массив в коде Live

Как я могу получить содержимое из поля прокрутки и поместить содержимое в массив в коде Live. У меня есть код для замены содержимого в массиве

on mouseUp
   put "" into field f1
   put "red,RED" & CR & "green,GREEN" & CR & "blue,BLUE" into myArrayToBe 
   split myArrayToBe by CR
   put the number of lines of (the keys of myArrayToBe) into myArraylength
  repeat with i = 1 to myArraylength 
   put  myArrayToBe[i] into y
   split y by comma
   put y[1] into searchStr
   put y[2] into replaceStr
   put replaceStr &CR after field f1
  end repeat
end mouseUp 

1 ответ

Эта функция должна сделать свое дело

function lines_to_array pLines
   put pLines into tArray
   split tArray by return
   RETURN tArray
end lines_to_array

пример

on mouseUp
   put lines_to_array(field "Guests") into tGuests

   -- do something with the array tGuests here
end mouseUp
Другие вопросы по тегам