LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
set the itemDelimiter to "."
put "jpg" & return & "jpeg" & return & "png" into myFormatList
put "1" into x
repeat
put last item of line x of field "someField" into myFormatExtension
put "no" into passTest
repeat with y = 1 to the number of lines of myFormatList
if myFormatExtension is line y of myFormatList then put "yes" into passTest
end repeat
if passTest is "no" then
delete line x of field "someField"
else
add 1 to x
end if
if (x > the number of lines of field "someField") or (field "someField" is empty) then exit repeat
end repeat
Last edited by xApple on Sun Jan 14, 2007 3:04 pm, edited 1 time in total.
This is simpler, and will be a lot faster, if the list of files is very long:
put fld "fileList" into tFList
set the itemDelimiter to "."
repeat for each line L in tFList
if item -1 of L is among the items of "jpg,jpeg,png,gif" then
put L & cr after tFilteredList
end if
end repeat
put char 1 to -2 of tFilteredList into fld "fileList"