1)a different script will generate a random sentence, store it in variable 'SearchHere'
2)use 'if' condition to see if any word in 'SearchHere' contains/matches any word in an array string (what I need help with)
3)if a word from array string exists in 'SearchHere', then 'if' condition executes, otherwise checks the next 'else if' condition
4)be able to check for any single word from multiple arrays using 1 'if' condition
Code: Select all
SearchHere := "This will contain a randomly generated string everytime script runs and will get searched to see if any word from it matches any word from arrays below"
StrArray := {"Any", "single", "word", "here", "can", "be", "matched"} ; just for example. Actual words would be like "Document7"
StrArray2 := {"Another", "list", "to", "check"}
; What I've tried so far but hasn't quite worked
if (SearchHere contains %StrArray%) ; search for any word from an array, hasn't worked yet
{
(statement)
}
; search for word from single or multiple arrays. Tried different versions here but none seem to work
; else if (InStr(StrArray, Document7)) (tried a different way to search for just one specific word from an array)
; else if "Document7" in %StrArray2% (also tried it using brackets like ["Document8", "Doc8"])
else if (SearchHere contains %StrArray% || %StrArray2%) ; search for any word from multiple arrays
{
(statement2)
}
else
{
(statement3)
}