Oh sure. It takes the file and uses the tokenat expression to look at it a line at a time.
One event sees if the line starts with #recipe, if it does it uses the rest of that line as the name of a new recipe.
The other event handles either blank lines or lines that have a number followed by an ingredient name.
Left() gets the left side of some text
Mid() gets the middle
Trim() removes any leading and trailing spaces in the text.
Finally it keeps track of the uid of the last recipe created. That is just so we can pick it again when adding ingredients to it.
Thank you for the explanation. If you don't mind a few questions just to make sure I understand this correctly.
* When the event says "recipe > Set name to mid(line, 8, 100)", are you basically extracting the name of the recipe? You're using "mid" here since "left" is = to #recipe? Wouldn't "8" here count the space just before the recipe's name? Or does it ignore it? Also if you don't mind why 100? Is it arbitrary long so you can capture whatever name is here?
* In the Else statement, there is System > Set count to int(line). The way I understand it is, line is equal to the current sentence (so in case of an ingredient for example "2 wormwood") how does int(someString) know what to grab as a number? I thought the "int" expression just approximates a float into an int?
* In the same Else statement there is a line that says System > Set ingredient to trim(mid(line, len(str(count)), 100)). Does this basically says "Trim the current line from spaces leading and ending" Then you check the middle part, that starts right after "how many count is in characters" and for 100 characters long? This goes back to the first question. If len(str(count)) is equal to 1 (because count is going to be the one number at the left of the recipe) then again, wouldn't that return " wormwood" instead of "wormwood"? I know you used Trim to negate if this happens, but you didn't use it in the other one, this is confusing to me.