I have 2 string ( MyWordList and MyFile) I need to fine out if any words from MyWordList are in MyFile I used
repeat with myWord from 1 to number of words in MyWordList
if (word myWord of MyWordList) is in myfile then
display dialog (word myWord of MyWordList)
end if
end repeat
that works great until it come to a word like I , A or any small word that may be contained in a bigger word. Is there a way to this with only 1 pass.
Thanks Steve
Model: G5
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
For a work like I or A you might try keeping the foreword and trailing spaces in the string so that you eleminate words which contain those letters, so:
If you make the two strings into lists of words first and then access them using “item”, it will work.
set MyWordList to words of "I like coffee!"
set MyFile to words of "And various other foods."
repeat with myWord from 1 to count MyWordList
if (item myWord of MyWordList) is in MyFile then
display dialog (item myWord of MyWordList)
end if
end repeat