nf67 Posted April 9, 2008 Posted April 9, 2008 Hello there, I was wondering if it's possible to create some kind of calculator with custom formulas... I'm dutch and I often use my own letters in formula's, since I only have very basic physics almost all formulas look the same. This is an example: A=B*C C=A/B B=A/C Now would I be able to create a calculator for this? That calculates the A if I fill in B and C? Thanks a lot, Chris
Madza91 Posted April 9, 2008 Posted April 9, 2008 Use search before posting question ! [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
nf67 Posted April 9, 2008 Author Posted April 9, 2008 I did. I had a look at some calculators in the Example Scripts, but I didn't understand them. That's why I posted
Bomi Posted April 9, 2008 Posted April 9, 2008 (edited) The short answer to your question is: Yes! The long and slightly more complex answer is: Yes, you would be able to do this if you are willing to do a bit of reading and put a bit of effort into it. Edited April 9, 2008 by Bomi
weaponx Posted April 10, 2008 Posted April 10, 2008 I am not sure what level of complexity you were looking for but I came up with this. 1. Fill in the constants with alphabet characters and their associated equation. 2. Enter the equation you want to compute using the constants you entered. A = 1 B = 2 C = 3 Equation = A+B+C Effective equation = 1+2+3 Result = 6 expandcollapse popup#include <GUIConstants.au3> GUICreate("My GUI", 400, 480) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box GuiCtrlCreateLabel("Constant", 10,10) GuiCtrlCreateLabel("Formula", 200,10) Dim $array[10][2] For $Y = 0 to 9 $array[$Y][0] = GuiCtrlCreateInput("", 20,($Y * 25)+30,20,20) $array[$Y][1] = GuiCtrlCreateInput("", 70,($Y * 25)+30,320,20) Next GuiCtrlCreateLabel("Equation", 10,300) $equationInput = GuiCtrlCreateInput("", 10,320,380,20) GuiCtrlCreateLabel("Effective Equation", 10,350) $effectiveInput = GuiCtrlCreateInput("", 10,370,380,20) GuiCtrlCreateLabel("Answer", 10,400) $answerInput = GuiCtrlCreateInput("", 10,420,380,20) $button = GuiCtrlCreateButton("Calculate", 170, 450, 60, 20) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button Calculate() EndSwitch Wend Func Calculate() $final = GuiCtrlRead($equationInput) For $Y = 0 to 9 $constant = GuiCtrlRead($array[$Y][0]) $formula = GuiCtrlRead($array[$Y][1]) If IsString($constant) and StringLen($constant) > 0 Then $final = StringReplace($final, $constant,$formula) EndIf Next GuiCtrlSetData($effectiveInput, $final) GuiCtrlSetData($answerInput, Execute($final)) EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now