Just checking out Text Blaze. Very cool. One feature I was hoping for was that I could do simple calculations within a text field. For example, typing something like "/=23+42" would replace what I typed with 65. So far as I can tell, you can use formulas like this in a snippet but not directly?
Hey @Joshua_Fialkoff and welcome to the forum. I was thinking of building something like that. What types of calculations are you looking to do?
Hey Dan! Thanks for the response. Basic arithmetic would be sufficient for our needs: +, -, *, /. And it would be great if parentheses could be used as well (e.g., in a price based on margin calculation like 1/(1-.3)).
I looked into it, and unfortunately, I can't make it work since Text Blaze doesn't support recursive functions. I'll continue exploring
Thanks Dan. I guess I'm not sure how recursion plays into this but, regardless, would love to see this feature. Cheers.
Hi @Joshua_Fialkoff,
You can use mathematical expressions in a text field with parenthesis and use its result in your snippet. You can check the following snippet.
{note}
{formtext: name=eqn; default=23+(1+41)}
{endnote}{=("() -> " & eqn)()}
Thanks Ashwin. I'm new to TextBlaze and having some difficulty following your advice. Are you saying that I can create a snippet that uses the contents of a text field to populate the eqn variable in your script? How would I initiate this in a text field?
Yes, you can name the text field as eqn
or any name of your choice and keep it in a note so that will not be inserted and keep the equation evaluation outside the note so that it will be inserted as I did.
@Joshua_Fialkoff
You can also utilize your clipboard. Copy your calculation then activate this as a snippet
{eqn={clipboard}}{=("() -> " & eqn)()}