01-16-2009, 08:41 AM
Macro
out
str SearchWord
inp- SearchWord "Ask me a question about who what where and when" "" "type your question here"
SearchWord.setfile("$program files$\QueryProgram\Searches.txt" -1 -1 1)
str When="null123"
str Who="null123"
str Where="null123"
str What="null123"
Dir d Parent
foreach(Parent "$Program Files$\QueryProgram\WordLists\*" FE_Dir 0x1)
,str directory.format("$program files$\QueryProgram\WordLists\%s\*" Parent.FileName)
,foreach(d directory FE_Dir)
,,str sPath=d.FileName(1)
,,str WordList.getfile(sPath)
,,str ID.getfilename(sPath)
,,ARRAY(str) arr
,,int i nt
,,nt = tok(WordList arr -1 "[]")
,,for(i 0 nt)
,,,arr[i]-"*"
,,,arr[i]+"*"
,,,if(matchw(SearchWord arr[i] 1))
,,,,arr[i].findreplace("*")
,,,,SearchWord.findreplace(arr[i] "" 1)
,,,,str object=Parent.FileName
,,,,if object="Who";Who=ID
,,,,if object="What";What=ID
,,,,if object="Where";Where=ID
,,,,if object="When";When=ID
if Who="null123"; Who="anyone"
if Where="null123"; Where="anywhere"
if When="null123"; When="anytime"
if What="null123"; What="anything"
_s.format("You will be searching for %s doing %s %s %s." Who What Where When)
mes _s