Jump to content

Search the Community

Showing results for tags 'alcohol'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. This is a script I made to enable me to be able to combine either something non-alcoholic with something alcoholic and know how much to add (easy on a calculator) but then also to be able to deal with two alcoholic drinks and know how much of the second one will be needed to get to a desired strength (much much harder to figure out). It runs through by adding the second alcoholic liquid in increments of 0.5 ml until it meets exactly or the first number that exceeds the desired strength. It simplifies the whole process since it just tries all the combinations rather that doing complicated math to equate one thing to another and try and work it that way. it is very easy to use. Supply it with the original liquid, whether its wine or lemonade etc, then the strength of that liquid in % or 0 for non-alcoholic drink. Then set the percentage of the alcoholic liquid you will be using to add to the first liquid and what strength you would like your drink to be. Hit the button and you get your answer. AutoItSetOption('TrayAutoPause', 0) Global $OrigQty, $OrigStr, $AddStr, $DesiredStr, $Result #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Alcohol Calculator", 288, 188, -1, -1) $OrigQty = GUICtrlCreateInput("150", 16, 16, 121, 21, $ES_CENTER) $OrigStr = GUICtrlCreateInput("12.5", 152, 16, 121, 21, $ES_CENTER) $AddStr = GUICtrlCreateInput("40", 16, 72, 121, 21, $ES_CENTER) $Label1 = GUICtrlCreateLabel("Amount of original liquid", 16, 40, 115, 17) $Label2 = GUICtrlCreateLabel("Strength of original liquid", 152, 40, 119, 17) $Label3 = GUICtrlCreateLabel("Strength of alcohol to use", 16, 96, 128, 17) $DesiredStr = GUICtrlCreateInput("20", 152, 72, 121, 21, $ES_CENTER) $Label4 = GUICtrlCreateLabel("Desired alcohol strength", 152, 96, 118, 17) $calculate = GUICtrlCreateButton("Calculate", 104, 120, 83, 25) $Result = GUICtrlCreateInput("", 5, 152, 277, 21, $ES_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $calculate Strength(GUICtrlRead($OrigQty), GUICtrlRead($OrigStr), GUICtrlRead($AddStr), GUICtrlRead($DesiredStr)) EndSwitch WEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: Desired alcoholic strength calculator ; Description ...: This example code lets you calculate how much of an alcoholic drink to add to something else to make the resulting drink a certain strength. ; Syntax ........: Strength($MillilitersOfOriginalDrink, $StrengthOfOriginalDrink, $StrengthOfAddedLiquid, $DesiredStrength) ; Parameters ....: $MillilitersOfOriginalDrink- How much of a certain drink you start out with (either alcoholic or otherwise). ; $StrengthOfOriginalDrink- If the original drink is alcoholic then put the percentage here else put 0. ; $StrengthOfAddedLiquid- What strength of alcohol do you have to work with?. ; $DesiredStrength - How strong do you want your resulting drink to be?. ; Return values .: Text string with the needed information. ; Author ........: Wesley G aka Morthawt ; =============================================================================================================================== Func Strength($MillilitersOfOriginalDrink, $StrengthOfOriginalDrink, $StrengthOfAddedLiquid, $DesiredStrength) If $DesiredStrength > $StrengthOfAddedLiquid And $StrengthOfOriginalDrink > 0 Then MsgBox(0, 'Error', 'Your desired strength exceeds the strength of the liquid used to provide extra alcohol content.') Exit ElseIf $DesiredStrength <= $StrengthOfOriginalDrink And $StrengthOfOriginalDrink <> 0 Then MsgBox(0, 'Error', 'Your desired strength is lower than is even possible with the chosen liquids.' & @CRLF & @CRLF & 'Pick a higher desired strength.') Exit EndIf Local $Amount = 0, $AlcoholContent = 0 $ConstAlc = $MillilitersOfOriginalDrink * ($StrengthOfOriginalDrink / 100) $StrengthOfAddedLiquid = $StrengthOfAddedLiquid / 100 Do $Amount += 0.5 ; This is the increment of milliliters we will go up each time to try and reach the desired amount of strength. $AlcoholContent = Round(((($ConstAlc + ($Amount * $StrengthOfAddedLiquid)) / ($MillilitersOfOriginalDrink + $Amount)) * 100), 2) Until $AlcoholContent >= $DesiredStrength GUICtrlSetData($Result, 'Add ' & $Amount & 'ml of alcoholic liquid to get to ' & $AlcoholContent & '%') Return 1 EndFunc ;==>Strength
×
×
  • Create New...