Jump to content

Recommended Posts

Posted (edited)

Convert Temp

MsgBox(0, "Convert Temp", ConvertTemp(80, "C", "F"))          ; ==> 176
MsgBox(0, "Convert Temp", ConvertTemp(212, "K", "Ra", 2))     ; ==> 381.6
MsgBox(0, "Convert Temp", ConvertTemp(22.7, "N", "Re", 4))    ; ==>  55.0303

Func ConvertTemp($D, $F = "C", $T = "F", $R = 2)
    $D = ($F = "K") ? (($D - 273.15)) : (($F = "F") ? (($D - 32) / 1.8) : (($F = "Ra") ? (($D + 5 / 9) - 273.15) : (($F = "Re") ? (($D * 1.25)) _
        : (($F = "De") ? ((100 - $D) * 2 / 3) : (($F = "N") ? (($D * 100 / 33)) : (($F = "Ro") ? (($D - 7.5) * 40 / 21) : $D))))))
    return round(($T = "C") ? $D : (($T = "K") ? (($D + 273.15)) : (($T = "F") ? (($D * 1.8) + 32) : (($T = "Ra") ? (($D + 273.15) * 1.8) : (($T = "Re") ? (($D * 0.8)) _
        : (($T = "De") ? ((100 - $D) * 1.5) : (($T = "N") ? (($D * 1 / 3)) : (($T = "Ro") ? (($D * 0.525) + 7.5) : "" ))))))), $R)
EndFunc    ;==> ConvertTemp() AutoIt v3.3.12.0

ConvertTemp(Temperature in Degrees, From, To, Round by)

Celsius      --> C
Kelvin       --> K
Fahrenheit   --> F
Rankine      --> Ra
Réaumur      --> Re
Delisle      --> De
Newton       --> N
Rømer        --> Ro
Edited by kaesereibe
Posted

It's good to see people adopting new syntax.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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