WeMartiansAreFriendly Posted November 14, 2008 Share Posted November 14, 2008 This script will calculate your BMI (Body Mass Index) among other things, a GUI will come shortly. Thought I'd share an old script that was collecting dust. Original Author (javascript): http://home.fuse.net/clymer/bmi/expandcollapse popup;Just change the variables appropriately. $nWeight = 150 $nHeightFt = 5 $nHeightIn = 10 $nWaist = 33 $sSex = "m" $nAge = 21 $arr = _BMICalc($nWeight, $nHeightFt, $nHeightIn, $nWaist, $sSex, $nAge) ; _CalcBMI(160, 5, 9, 36, 'm', 19) $arm = _BMIMsg($arr, $sSex) msgbox(0,'', _ 'Body Mass Index (BMI): '& $arr[1]&@lf& _ @TAB & $arm[1] &@lf& _ 'Waist to height (WtHR): '& $arr[2]&@lf& _ 'Body Fat: '& $arr[3]&@lf& _ 'Surface Area: '& $arr[4]&@lf& _ 'Basal Metabolic Rate (BMR): '& $arr[5]&@lf& _ 'Willoughby Athlete Weight: '& $arr[6]&@lf& _ 'Willoughby Athlete Waist: '& $arr[7]&@LF) Func _BMIMsg(ByRef $aArr, $sSex, $Ext = 0) Local $aArray[8], $sBMIText[8][8][8] $sBMIText[1][1][1] = 'Underweight.'; The lower the BMI the greater the risk' $sBMIText[2][1][1] = 'Normal';, very low risk' $sBMIText[3][1][1] = 'Marginally overweight';, some risk' $sBMIText[4][1][1] = 'Overweight';, moderate risk' $sBMIText[5][1][1] = 'Severe overweight';, high risk' $sBMIText[6][1][1] = 'Morbid obesity';, very high risk' #cs A BMI from 20 through 26: desirable for most middle-aged adults. Nonsmokers with a consistent BMI within this range have the lowest risk of disease and premature death. In this category, weight gain can be avoided through moderate eating habits and exercise. A BMI from 27 through 29: moderately overweight, carries a slightly increased risk of weight-related health problems, such as high blood pressure, high blood cholesterol, heart disease and adult-onset diabetes. People in this group have the hardest decision to make about reducing, given the potential health risks of weight loss. To prevent the development of weight-related health problems, most people in this category should avoid gaining additional pounds by adopting a low-fat diet and a routine of regular exercise. Weight loss for cosmetic reasons is very common here. A BMI of 30 through 40: truly overweight, the risk of developing heart disease and other weight-related conditions rises sharply. Most people should lose weight in this category. Adult-onset diabetics in this category should definitely reduce, since blood-sugar control improves with weight loss. A BMI of 40 or more; severely overweight, you are in great danger of dying early. 80% eat in frequent binges. Secret eating is common. Best weight loss technique is often a fasting diet. Benefits of losing weight clearly outstrip any dangers. #ce ;Underweight If $sSex = 'm' And $aArr[1] < 20.7 Then $aArray[1] = $sBMIText[1][1][1] If $sSex = 'w' And $aArr[1] < 19.1 Then $aArray[1] = $sBMIText[1][1][1] ;Normal If $sSex = 'm' And $aArr[1] >= 20.7 And $aArr[1] <= 26.4 Then $aArray[1] = $sBMIText[2][1][1] If $sSex = 'w' And $aArr[1] >= 19.1 And $aArr[1] <= 25.8 Then $aArray[1] = $sBMIText[2][1][1] ;Marginally overweight If $sSex = 'm' And $aArr[1] >= 26.4 And $aArr[1] <= 27.8 Then $aArray[1] = $sBMIText[3][1][1] If $sSex = 'w' And $aArr[1] >= 25.8 And $aArr[1] <= 27.3 Then $aArray[1] = $sBMIText[3][1][1] ;Overweight If $sSex = 'm' And $aArr[1] >= 27.8 And $aArr[1] <= 31.1 Then $aArray[1] = $sBMIText[4][1][1] If $sSex = 'w' And $aArr[1] >= 27.3 And $aArr[1] <= 32.2 Then $aArray[1] = $sBMIText[4][1][1] ;Severe overweight If $sSex = 'm' And $aArr[1] >= 31.1 And $aArr[1] <= 45.4 Then $aArray[1] = $sBMIText[5][1][1] If $sSex = 'w' And $aArr[1] >= 32.2 And $aArr[1] <= 44.8 Then $aArray[1] = $sBMIText[5][1][1] ;Morbid obesity If $sSex = 'm' And $aArr[1] >= 45.4 Then $aArray[1] = $sBMIText[6][1][1] If $sSex = 'w' And $aArr[1] >= 44.1 Then $aArray[1] = $sBMIText[6][1][1] Return $aArray EndFunc Func _BMICalc($nWeight = 150, $nHeightFt = 5, $nHeightIn = 10, $nWaist = 34, $sSex = 'm', $nAge = 50) ;http://home.fuse.net/clymer/bmi/ (javascript code converted to autoit) Local $aArray[8] $weight = 1 * $nWeight $height = 12 * $nHeightFt + 1 * $nHeightIn $bmi = $weight/2.2/( (($height*0.0254)^2) ); ;$weight/2.2/(pow(($height*0.0254),2)); $bmi = round(10*$bmi)/10; ;document.forms.f.bmifield.value= bmi.toString(); $aArray[1] = $bmi $waist = 1 * $nWaist $wthr = $waist/$height*100; $wthr = round(10*$wthr)/10; ;document.forms.f.whtrfield.value=wthr.toString(); $aArray[2] = $wthr If $sSex = 'm' Then $sSex = 1 Else $sSex = 0 EndIf $sex = 1*$sSex $fat = ($sex==1) * 100*(-98.42 + 4.15*$waist - 0.082*$weight)/$weight + _ ($sex==0) * 100*(-76.76 + 4.15*$waist - 0.082*$weight)/$weight; $fat = round($fat*10)/10; ;document.forms.f.fatfield.value=fat.toString(); $aArray[3] = $fat $area = ($height * ($weight/3131)) ^ 0.50; ;pow($height * $weight/3131, 0.50); $area = round($area*100)/100; ;document.forms.f.areafield.value=area.toString(); $aArray[4] = $area $age = 1*$nAge $bmr = ($sex==1)*(13.75*$weight/2.2 + 5.003*$height*2.54 - 6.775*$age + 66.5) + _ ($sex==0)*(9.563*$weight/2.2 + 1.850*$height*2.54 - 4.676*$age + 655.1); $bmr = round($bmr); ;document.forms.f.bmrfield.value=bmr.toString(); $aArray[5] = $bmr $willwt = ($height^3)/1906; ;pow($height,3)/1906; $willwt = round($willwt); ;document.forms.f.willwtfield.value=willwt.toString(); $aArray[6] = $willwt $willwaist = $height*0.4584; $willwaist = round($willwaist*10)/10; ;document.forms.f.willwaistfield.value=willwaist.toString(); $aArray[7] = $willwaist Return $aArray EndFunc Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
weaponx Posted November 14, 2008 Share Posted November 14, 2008 I created a nice BMI chart here, maybe you can get some ideas:#508021 Link to comment Share on other sites More sharing options...
TehWhale Posted November 14, 2008 Share Posted November 14, 2008 (edited) Wahh I'm underweight. Works Great Edited November 14, 2008 by TehWhale Link to comment Share on other sites More sharing options...
Skrip Posted November 14, 2008 Share Posted November 14, 2008 Fuck. I'm also underweight. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 14, 2008 Share Posted November 14, 2008 Works pretty well . I'm normal so on you all im 3.7% bodyfat by this lol. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
icadea Posted November 14, 2008 Share Posted November 14, 2008 thanks. Link to comment Share on other sites More sharing options...
JRowe Posted November 14, 2008 Share Posted November 14, 2008 A BMI of 40 or more; severely overweight, you are in great danger of dying early. 80% eat in frequent binges. Secret eating is common. Best weight loss technique is often a fasting diet. Benefits of losing weight clearly outstrip any dangers.Uh, no... With a BMI of 40 or more, that eating isn't secret anymore. Neat script! Throw together some more health related calculations, maybe a calorie tracker, and you could have a saleable program [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Innovative Posted November 14, 2008 Share Posted November 14, 2008 (edited) Is this really working ? I'm 96 KG and it says that i'm underweight and BMI : 0Edit : ..$nWeight = 96$nHeightFt = 5.544608333$nHeightIn = 66.5353$nWaist = 40$sSex = "m"$nAge = 15 Edited November 14, 2008 by xVivoCity Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted November 14, 2008 Author Share Posted November 14, 2008 (edited) @weaponx Thanks for the script, I will surely use that. Is this really working ? I'm 96 KG and it says that i'm underweight and BMI : 0 Edit : ..The weight is calculated in pounds. $nWeight = 211.6437714;96 KG $nHeightFt = 5;feet $nHeightIn = 5;inches $nWaist = 40 $sSex = "m" $nAge = 15 expandcollapse popupConsoleWrite( ConvertWeight(96, 'KG', 'P') & " pounds" &@LF) ConsoleWrite( ConvertLength(66.5353, 'in', 'ft') &" feet" &@LF) ;For Weight Func ConvertWeight($vFrom, $WeightFromUnits = "Pounds", $WeightToUnits = "Ounces") If Not IsNumber(Number($vFrom)) Then Return SetError(1, 0, 0) Local $avUnits[6][3] = [["Ounces","O", 1], ["Pounds","P",16], ["Stone","S", 224], ["Milligrams","M", 3.52739619 * 10 ^ - 5], _ ["Grams","G",0.0352739619], ["Kilograms","Kg", 35.2739619]] Local $vTo, $iUnit For $iUnit = 0 To UBound($avUnits) - 1 If $WeightFromUnits = $avUnits[$iUnit][0] Or $WeightFromUnits = $avUnits[$iUnit][1] Then $vFrom *= $avUnits[$iUnit][2] EndIf Next For $iUnit = 0 To UBound($avUnits) - 1 If $WeightToUnits = $avUnits[$iUnit][0] Or $WeightToUnits = $avUnits[$iUnit][1] Then $vTo = $vFrom / $avUnits[$iUnit][2] EndIf Next Return $vTo EndFunc ;==>ConvertWeight ;For Height Func ConvertLength($vFrom, $LengthFromUnits = "Inches", $LengthToUnits = "Feet") If Not IsNumber(Number($vFrom)) Then Return SetError(1, 0, 0) Local $avUnits[8][3] = [["Inches","in", 1], ["Feet","ft", 12], ["Yards","yd", 36], ["Miles","mi", 63360], _ ["Millimetres","mm", 0.0393700787], ["Centimetres","cm", 0.393700787], ["Metres","me", 39.3700787], ["Kilometres","km", 39370.0787]] Local $vTo, $iUnit For $iUnit = 0 To UBound($avUnits) - 1 If $LengthFromUnits = $avUnits[$iUnit][0] Or $LengthFromUnits = $avUnits[$iUnit][1] Then $vFrom *= $avUnits[$iUnit][2] EndIf Next For $iUnit = 0 To UBound($avUnits) - 1 If $LengthToUnits = $avUnits[$iUnit][0] Or $LengthToUnits = $avUnits[$iUnit][1] Then $vTo = $vFrom / $avUnits[$iUnit][2] EndIf Next Return $vTo EndFunc ;==>ConvertLength Edited November 14, 2008 by Kastout Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
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