question about a list count and how to set to a looping script.

Hi,

I have a text sting and i need to have the list counted then each item in the list made into a variable Then I need to have the variable put in a looping script according to how many items are in the initial text string. example:
{“1”,“2”,“3”,“…”}

tell application “Portfolio 8.1”
– 3 part find example
set theQuery to “Filename” & tab & “contains” & tab & “(variable 1 from list)” & tab & return
& “Filename” & tab & “contains” & tab & “(variable 2 from list)” & return & “Filename” & tab & “contains” & tab & “(variable 3 from list)” & return & “Filename” & tab & “contains” & tab & “(variable … from list)”
–and so on and so on untill the list count is exausted…

how do you set up the list to be counted and set to variables then loop the script to include the appropriate variables from the list???.

thanks in advance for your time!!!

Hi,

try this

set theList to {"1", "2", "3"}

set theQuery to ""
repeat with i in theList
	set theQuery to theQuery & "Filename" & tab & "contains" & tab & i & tab & return
end repeat

Hi,

To count list you can use ‘count’ or ‘length’ usually.

set l to {1,2,3}
count l

To get a list from a string:

set t to “a
b
c”
set l to paragraphs of t

You can also use text items but that’s another story.

gl,