Jump to content

How could I use a formula stored as a string?


Recommended Posts

I need to grab formulas from an XML file, then process a variable using the formula. For example:

<Word Number="1" Type="Dec" Formula="$n=$n*25" />
<Word Number="2" Type="Dec" Formula="$n=($n + 28.06)/2.71" />
<Word Number="3" Type="Dec" Formula="$n=$n*5/256" />

I can get the formula pulled from XML without a problem but I then have strings:

$formula1 = "$n=$n*25"

$formula2 = "$n=($n + 28.06)/2.71"

$formula3 = "$n=$n*5/256"

I could use StringTrim to get it down to Formula1 = "$n*25" then say $n = $formula but since formula's a string, I just end up with a copy of the formula string as $n. Would anyone know how to handle something like this? Thanks!

Link to comment
Share on other sites

You could try Execute :P

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...