Hey, all. I got Multimedia Fusion 2 Developer. Many happies. ANYWAY...
So, I made an INI database of a bunch of Japanese words, and I'm trying to figure out how to do the following:
1) User types word(s) into edit box, clicks "Send" or something like that activating the next step.
2) Computer checks through INI file to verify that the words exist.
3) If a word is found that does not exist, write it to the INI file.
Okay, I figured it out. Now I've realized that I need it to check each individual word. Is that possible? For instance, if I type, "I like pie", can it check "I", "like" and "pie" separately?
In case it matters, each word in the database is in its own group.
If the groups names are numbered in some sort of coherent order, you could check against GroupItem$("Ini", "Groupname" + Str$(value of some counter), "ItemName") continually and compare this to the entered word (the GetText$() of the Edit box), incrementing the counter each time until the group is not found.
hoohoohoo, maybe der is some way to store it all as a big-ass string, then u can load it up and split it with some string functions like in VB then you could jus loop thru the array indexes... or if you really couldn't do that maybe embed a php page, program yer skript in php because it can manage strings and such, then just serialize the string and store its contents to an ini file. The possibilities are endless man!
The way I'd probably do it is using String Parser to get each individual word (use a space as delimeter). Then my INI file would look something like this:
Cheese=1
Sausage=2
Ham=3
Pork=4
And so on - the numbers aren't needed, would just be there to return some kind of value. Then in the loop, you just set to retrieve the value of the items "Cheese" and "Ham" or whatever, and if you get a return value - then the word exists. And you don't get a return value, then the word doesn't exist. I'll try making an example file - I've no idea if this method works at all
Edit: Made an example file. I have tested it and I think it works - take a look anyway!
In this case, if the word doesn't exist then a string is set to tell you it doesn't exist. In your case, you'd just add the word to the INI or do whatever you want.
You know, I have to call Flava's method absolute genius - it seems completely backwards at first glance, but makes things a lot simpler. I'm impressed!
* Button "Check Words" clicked
- String Parser: Set Source string to Edittext$("Sentence")
- Sentence: Set string to ""
- Start loop "checkword" listCount("String Parser") times
* On loop "checkword"
+ FindStringExact("Dictionary", listGetAt$("String Parser", LoopIndex("checkword")+1), 0) = -1
- Sentence: Set string to "NON-EXISTANT WORD EXISTS"
Instead of changing the string, you can add the word to the List Object
Yeh my example file is a bit broke - but you get the idea. I kind of rushed the loops and stuff, but if you get them right then I'm sure the method would work.