AutoFoolit Posted August 17, 2013 Posted August 17, 2013 (edited) Hi there ! First post and first time i need help! So, im mixing my own e-juice and found lots of programs that tells you how much you need to use of the diffrent liquids. Just not exatly what i needed. I have made an exel ( calc ) that can calculate it, but programs are the way to go. My problem is that i cant calculate other settings that the one i have set to standart. Or it mis calculate it. If anyone would like to help ill be glad! - The program will be free for all and opensorce when its done. Link to exel sheet ( open office ) filedropper.com/pgvgh2ocalculator Now to the whole script: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GuiOnEventMode", 1) Global $VolumeCheckPH = '' Global $NicotineTotalH = '' Global $PGNicotineVolumeH = '' Global $VGVolumeH = '' Global $H2OVolumeH = '' Global $PGVolumeH = '' Global $VolumeCheckH = '' #Region ### START Koda GUI section ### $Form1_1 = GUICreate("Mixing Table", 479, 328, 189, 123) $EXIT_B = GUICtrlCreateButton("Exit", 394, 277, 65, 33) GUICtrlSetOnEvent(-1, "EXIT_B");...................................................Exit button! $CALCULATE_B = GUICtrlCreateButton("Calculate", 258, 277, 129, 33) GUICtrlSetOnEvent(-1, "CALCULATE_B");.............................Calculate Button! $P_G = GUICtrlCreateInput("55", 100, 140, 33, 24);............................... PG xx procent GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $V_G = GUICtrlCreateInput("35", 100, 180, 33, 24) ;.............................. VG xx procent GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $H_2_O = GUICtrlCreateInput("10", 100, 220, 33, 24) ;............................ H2O xx procent GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateInput("%", 132, 140, 22, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateInput("%", 132, 180, 22, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateInput("%", 132, 220, 22, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $PG = GUICtrlCreateLabel("PG", 76, 143, 23, 20) ;....... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $VG = GUICtrlCreateLabel("VG", 76, 183, 23, 20) ;....... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $H2O = GUICtrlCreateLabel("H2O", 68, 223, 31, 20);...... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Amount_To_Make = GUICtrlCreateLabel("Amount to make:", 16, 28, 103, 20) ;... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $A_T_M = GUICtrlCreateInput("300", 120, 25, 46, 24) ;............................ Amount to make xx ml GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 5) $ml = GUICtrlCreateInput("ml", 165, 25, 21, 24) ;.......... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Strenght_To_Make = GUICtrlCreateLabel("Strenght to make:", 12, 53, 107, 20) ;.. label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $S_T_M = GUICtrlCreateInput("19", 120, 50, 21, 24) ;.................................. Strenght to make xx GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 5) $mg_ml = GUICtrlCreateInput("mg/ml", 140, 50, 46, 24) ;............ label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Volume_Check = GUICtrlCreateLabel("Volume check", 10, 263, 89, 20) ;... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $V_C_P = GUICtrlCreateInput("", 100, 260, 33, 24) ;.................................... Volume check procent GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateInput("%", 132, 260, 22, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("PG nicotine", 45, 78, 72, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $P_G_N = GUICtrlCreateInput("38", 120, 75, 21, 24) ;..................................... PG Nicotine xx mg/ml GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 5) $Input5 = GUICtrlCreateInput("mg/ml", 140, 75, 46, 24) ;...... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Nicotine total", 19, 289, 81, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $N_T = GUICtrlCreateInput("", 100, 285, 56, 24) ;.......................................... Nicotine total GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateInput("mg", 155, 285, 26, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("PG nicotine", 313, 29, 72, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $P_G_N_M = GUICtrlCreateInput("", 385, 25, 51, 24) ;.................................... Last PG nicotine GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Input6 = GUICtrlCreateInput("ml", 435, 25, 21, 24) ;...... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("PG", 363, 54, 23, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $P_G_M = GUICtrlCreateInput("", 385, 50, 51, 24) ;................................... Last PG GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Input8 = GUICtrlCreateInput("ml", 435, 50, 21, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("VG", 363, 79, 23, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $V_G_M = GUICtrlCreateInput("", 385, 75, 51, 24) ;....................................... Last VG GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Input10 = GUICtrlCreateInput("ml", 435, 75, 21, 24) ;..... label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("H2O", 354, 104, 31, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $H_2_O_M = GUICtrlCreateInput("", 385, 100, 51, 24) ;....................................... Last H2O GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Input12 = GUICtrlCreateInput("ml", 435, 100, 21, 24) ;.......label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Label1 = GUICtrlCreateLabel("Volume check", 297, 143, 89, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $V_C = GUICtrlCreateInput("", 385, 140, 51, 24) ;......................................... Last volume check GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Input14 = GUICtrlCreateInput("ml", 435, 140, 21, 24);.......label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Aroma", 75, 103, 44, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $AROMA = GUICtrlCreateInput("5", 120, 100, 21, 24) ;............label GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 5) GUICtrlCreateInput("%", 140, 100, 22, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Strenght with aroma", 265, 168, 120, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $S_W_A = GUICtrlCreateInput("", 385, 165, 26, 24) ;.......................................Strenght with aroma ( Not used yet ) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateInput("mg/ml", 410, 165, 46, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) GuiSetOnEvent($GUI_EVENT_CLOSE, "EXITX") #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Button code start here..................................................................................................... Func EXIT_B() Exit EndFunc Func EXITX() If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit EndFunc Func CALCULATE_B() $VolumeCheckPH = Int(GUICtrlRead($P_G) + Int(GUICtrlRead($V_G) + Int(GUICtrlRead($H_2_O)))) If $VolumeCheckPH > 100 then SoundPlay(@WindowsDir & "\media\chord.wav", 1) MsgBox(4096, "WARNING", "Volume check MUST be at 100%", 10) ElseIf $VolumeCheckPH < 100 then SoundPlay(@WindowsDir & "\media\chord.wav", 1) MsgBox(4096, "WARNING", "Volume check MUST be at 100%", 10) EndIf GUICtrlSetData($V_C_P, $VolumeCheckPH) $NicotineTotalH = Int(GUICtrlRead($S_T_M) * Int(GUICtrlRead($A_T_M))) GUICtrlSetData ($N_T, $NicotineTotalH) $PGNicotineVolumeH = Int(GUICtrlRead($N_T) / Int(GUICtrlRead($P_G_N))) GUICtrlSetData($P_G_N_M, $PGNicotineVolumeH) $VGVolumeH = Int(GUICtrlRead($V_G) * Int(GUICtrlRead($A_T_M) / 100)) GUICtrlSetData($V_G_M, $VGVolumeH) $H2OVolumeH = Int(GUICtrlRead($H_2_O) * Int(GUICtrlRead($A_T_M) / 100)) GUICtrlSetData($H_2_O_M, $H2OVolumeH) $PGVolumeH = Int(GUICtrlRead($PGNicotineVolumeH) - Int(GUICtrlRead($VGVolumeH) - Int(GUICtrlRead($H2OVolumeH)/10))) GUICtrlSetData($P_G_M, $PGVolumeH) $VolumeCheckH = Int(GUICtrlRead($P_G_N_M) + Int(GUICtrlRead($P_G_M) + Int(GUICtrlRead($V_G_M) + Int(GUICtrlRead($H_2_O_M) )))) GUICtrlSetData($V_C, $VolumeCheckH) EndFunc Edited August 17, 2013 by Jos Added AutoIt Tag
Zedna Posted August 17, 2013 Posted August 17, 2013 Try to search Examples section of this forum, there are some Calculator projects already also with sources ... Resources UDF ResourcesEx UDF AutoIt Forum Search
AutoFoolit Posted August 17, 2013 Author Posted August 17, 2013 Used alot of calclator examples to understand how i needed to set this op. Still seems to fail at the end. But thanks for your answer!
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