I have a list like {“3232”, “3134”, “1122”, “3136”, “2233”, “3138”, “3344”, “3140”, “3140”, “3149”}
I need to remove item by position in other list, like {3, 5, 7}
The result must be like {“3232”, “3134”, “3136”, “3138”, “3140”, “3140”, “3149”}
To remove an item from a list, you can construct a new list that does not contain the unwanted items.
set resultList to {}
set sourceList to {"3232", "3134", "1122", "3136", "2233", "3138", "3344", "3140", "3140", "3149"}
set removeList to {3, 5, 7}
set sourceListCount to count sourceList
repeat with i from 1 to sourceListCount
if i is not in removeList then set end of resultList to item i of sourceList
end repeat
resultList
If the list only contains text objects you can set the text objects you don’t want to any other class and get only the text objects from them later. This way you only need to repeat three times and need no if statements at all.
set sourceList to {"3232", "3134", "1122", "3136", "2233", "3138", "3344", "3140", "3140", "3149"}
set removeList to {3, 5, 7}
repeat with i in removeList
set item i of sourceList to null
end repeat
set resultList to every text of sourceList