RazerM Posted April 21, 2006 Share Posted April 21, 2006 (edited) It isn't finished yet, i will add metric to imperial conversion(done). I will also add temperature(done),area and volume conversion. expandcollapse popup#include "trans.au3" $language = IniRead(@ScriptDir & "\config.ini", "Language", "Lang", "UK English") If Not FileExists(@ScriptDir & "\config.ini") Then IniWrite(@ScriptDir & "\config.ini", "Language", "Lang", "UK English") IniWrite(@ScriptDir & "\config.ini", "Notes", "NOTE:", "Use 'UK English' OR 'American English'") EndIf Global $LANG = GetLangArray($language) #include <GUIConstants.au3> GUICreate("Imperial to Metric Converter", 600, 300) $tab=GUICtrlCreateTab(10, 10, 580, 280) ;length GUICtrlCreateTabItem("Length") GUICtrlCreateLabel("Imperial:", 20, 35) $imperial = GUICtrlCreateInput("", 20, 50, 150) GUICtrlCreateLabel("Metric:", 270, 35) $metric = GUICtrlCreateInput("", 270, 50, 150) $convert = GUICtrlCreateButton("Convert", 180, 50, 80, 25);, $BS_DEFPUSHBUTTON) $iunits = GUICtrlCreateCombo("Inches", 20, 80) GUICtrlSetData($iunits, "Feet|Yards|Miles") $munits = GUICtrlCreateCombo($LANG[1], 270, 80);$munits = GUICtrlCreateCombo("Centimetres", 270, 80) GUICtrlSetData($munits, $LANG[2]);GUICtrlSetData($munits, "Millimetres|Metres|Kilometres") ;length a GUICtrlCreateLabel("Imperial:", 270, 130) $imperiala = GUICtrlCreateInput("", 20, 145, 150) GUICtrlCreateLabel("Metric:", 20, 130) $metrica = GUICtrlCreateInput("", 270, 145, 150) $converta = GUICtrlCreateButton("Convert", 180, 145, 80, 25);, $BS_DEFPUSHBUTTON) $iunitsa = GUICtrlCreateCombo("Inches", 270, 175) GUICtrlSetData($iunitsa, "Feet|Yards|Miles") $munitsa = GUICtrlCreateCombo($LANG[3], 20, 175);$munitsa = GUICtrlCreateCombo("Centimetres", 20, 175) GUICtrlSetData($munitsa, $LANG[4]);GUICtrlSetData($munitsa, "Millimetres|Metres|Kilometres") ;mass GUICtrlCreateTabItem("Mass") GUICtrlCreateLabel("Imperial:", 20, 35) $imperial2 = GUICtrlCreateInput("", 20, 50, 150) GUICtrlCreateLabel("Metric:", 270, 35) $metric2 = GUICtrlCreateInput("", 270, 50, 150) $convert2 = GUICtrlCreateButton("Convert", 180, 50, 80, 25);, $BS_DEFPUSHBUTTON) $iunits2 = GUICtrlCreateCombo("Ounces", 20, 80) GUICtrlSetData($iunits2, "Pounds|Stone") $munits2 = GUICtrlCreateCombo("Kilograms", 270, 80) GUICtrlSetData($munits2, "Milligrams|Grams") ;mass a GUICtrlCreateLabel("Imperial:", 270, 130) $imperial2a = GUICtrlCreateInput("", 20, 145, 150) GUICtrlCreateLabel("Metric:", 20, 130) $metric2a = GUICtrlCreateInput("", 270, 145, 150) $convert2a = GUICtrlCreateButton("Convert", 180, 145, 80, 25);, $BS_DEFPUSHBUTTON) $iunits2a = GUICtrlCreateCombo("Ounces", 270, 175) GUICtrlSetData($iunits2a, "Pounds|Stone") $munits2a = GUICtrlCreateCombo("Kilograms", 20, 175) GUICtrlSetData($munits2a, "Milligrams|Grams") ;temp GUICtrlCreateTabItem("Temperature") GUICtrlCreateLabel("Fahrenheit:", 20, 35) $imperial3 = GUICtrlCreateInput("", 20, 50, 150) GUICtrlCreateLabel("Celsius:", 270, 35) $metric3 = GUICtrlCreateInput("", 270, 50, 150) $convert3 = GUICtrlCreateButton("Convert", 180, 50, 80, 25);, $BS_DEFPUSHBUTTON) GUICtrlCreateLabel("Fahrenheit:", 270, 130) $imperial3a = GUICtrlCreateInput("", 20, 145, 150) GUICtrlCreateLabel("Celsius:", 20, 130) $metric3a = GUICtrlCreateInput("", 270, 145, 150) $convert3a = GUICtrlCreateButton("Convert", 180, 145, 80, 25);, $BS_DEFPUSHBUTTON) GUICtrlCreateTabItem("") GUISetState() ;~ $change = 1 ; the commented lines below were meant to change default button on each tab. There is two buttons on each tab so it isn't needed While 1 ;~ If GUICtrlRead($tab) = 0 And $change <> GUICtrlRead($tab) Then GUICtrlSetStyle($convert, $BS_DEFPUSHBUTTON) ;~ If GUICtrlRead($tab) = 1 And $change <> GUICtrlRead($tab) Then GUICtrlSetStyle($convert2, $BS_DEFPUSHBUTTON) ;~ If GUICtrlRead($tab) = 2 And $change <> GUICtrlRead($tab) Then GUICtrlSetStyle($convert3, $BS_DEFPUSHBUTTON) ;~ $change = GUICtrlRead($tab) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $convert Length(0) Case $converta Length(1) Case $convert2 Mass(0) Case $convert2a Mass(1) Case $convert3 GUICtrlSetData($metric3, (GUICtrlRead($imperial3)-32)*(5/9) & " °c") Case $convert3a GUICtrlSetData($metric3a, GUICtrlRead($imperial3a)*(9/5)+32 & " °F") ;~ Case EndSwitch WEnd Func Length($type) If $type = 0 Then If GUICtrlRead($iunits) = "Inches" Then $metrictemp = GUICtrlRead($munits) If $metrictemp = $LANG[5] Then; If $metrictemp = "Centimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*2.54 & " cm") ElseIf $metrictemp = $LANG[6] Then; ElseIf $metrictemp = "Millimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*25.4 & " mm") ElseIf $metrictemp = $LANG[7] Then; ElseIf $metrictemp = "Metres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.0254 & " m") ElseIf $metrictemp = $LANG[8] Then; ElseIf $metrictemp = "Kilometres" Then If GUICtrlRead($imperial) <= 3 Then GUICtrlSetData($metric, StringFormat("%0.5f",GUICtrlRead($imperial)*0.00003) & " km") If GUICtrlRead($imperial) > 3 Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.00003 & " km") EndIf ElseIf GUICtrlRead($iunits) = "Feet" Then $metrictemp = GUICtrlRead($munits) If $metrictemp = $LANG[9] Then; If $metrictemp = "Centimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*30.48 & " cm") ElseIf $metrictemp = $LANG[10] Then; ElseIf $metrictemp = "Millimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*304.8 & " mm") ElseIf $metrictemp = $LANG[11] Then; ElseIf $metrictemp = "Metres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.3048 & $LANG[12]); GUICtrlSetData($metric, GUICtrlRead($imperial)*0.3048 & " m") ElseIf $metrictemp = $LANG[13] Then; ElseIf $metrictemp = "Kilometres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.0003 & " km") EndIf ElseIf GUICtrlRead($iunits) = "Yards" Then $metrictemp = GUICtrlRead($munits) If $metrictemp = $LANG[14] Then; If $metrictemp = "Centimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*91.44 & " cm") ElseIf $metrictemp = $LANG[15] Then; ElseIf $metrictemp = "Millimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*914.4 & " mm") ElseIf $metrictemp = $LANG[16] Then; ElseIf $metrictemp = "Metres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.9144 & " m") ElseIf $metrictemp = $LANG[17] Then; ElseIf $metrictemp = "Kilometres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*0.00091 & " km") EndIf ElseIf GUICtrlRead($iunits) = "Miles" Then $metrictemp = GUICtrlRead($munits) If $metrictemp = $LANG[18] Then; If $metrictemp = "Centimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*160930 & " cm") ElseIf $metrictemp = $LANG[19] Then; ElseIf $metrictemp = "Millimetres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*1609300 & " mm") ElseIf $metrictemp = $LANG[20] Then; ElseIf $metrictemp = "Metres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*1609.3 & " m") ElseIf $metrictemp = $LANG[21] Then; ElseIf $metrictemp = "Kilometres" Then GUICtrlSetData($metric, GUICtrlRead($imperial)*1.6093 & " km") EndIf Else GUICtrlSetData($metric, "") EndIf ElseIf $type = 1 Then If GUICtrlRead($iunitsa) = "Inches" Then $metricatemp = GUICtrlRead($munitsa) If $metricatemp = $LANG[22] Then; If $metricatemp = "Centimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/2.54 & " in") ElseIf $metricatemp = $LANG[23] Then; ElseIf $metricatemp = "Millimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/25.4 & " in") ElseIf $metricatemp = $LANG[24] Then; ElseIf $metricatemp = "Metres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.0254 & " in") ElseIf $metricatemp = $LANG[25] Then; ElseIf $metricatemp = "Kilometres" Then If GUICtrlRead($imperiala) <= 3 Then GUICtrlSetData($metrica, StringFormat("%0.5f",GUICtrlRead($imperiala)/0.00003) & " in") If GUICtrlRead($imperiala) > 3 Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.00003 & " in") EndIf ElseIf GUICtrlRead($iunitsa) = "Feet" Then $metricatemp = GUICtrlRead($munitsa) If $metricatemp = $LANG[26] Then; If $metricatemp = "Centimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/30.48 & " ft") ElseIf $metricatemp = $LANG[27] Then; ElseIf $metricatemp = "Millimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/304.8 & " ft") ElseIf $metricatemp = $LANG[28] Then; ElseIf $metricatemp = "Metres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.3048 & " ft") ElseIf $metricatemp = $LANG[29] Then; ElseIf $metricatemp = "Kilometres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.0003 & " ft") EndIf ElseIf GUICtrlRead($iunitsa) = "Yards" Then $metricatemp = GUICtrlRead($munitsa) If $metricatemp = $LANG[30] Then; If $metricatemp = "Centimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/91.44 & " yds") ElseIf $metricatemp = $LANG[31] Then; ElseIf $metricatemp = "Millimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/914.4 & " yds") ElseIf $metricatemp = $LANG[32] Then; ElseIf $metricatemp = "Metres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.9144 & " yds") ElseIf $metricatemp = $LANG[33] Then; ElseIf $metricatemp = "Kilometres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/0.00091 & " yds") EndIf ElseIf GUICtrlRead($iunitsa) = $LANG[34] Then; ElseIf GUICtrlRead($iunitsa) = "Miles" Then $metricatemp = GUICtrlRead($munitsa) If $metricatemp = $LANG[35] Then; If $metricatemp = "Centimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/160930 & " mi") ElseIf $metricatemp = $LANG[36] Then; ElseIf $metricatemp = "Millimetres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/1609300 & " mi") ElseIf $metricatemp = $LANG[37] Then; ElseIf $metricatemp = "Metres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/1609.3 & " mi") ElseIf $metricatemp = $LANG[38] Then; ElseIf $metricatemp = "Kilometres" Then GUICtrlSetData($metrica, GUICtrlRead($imperiala)/1.6093 & " mi") EndIf Else GUICtrlSetData($metrica, "") EndIf EndIf EndFunc ;==>Length Func Mass($type) If $type = 0 Then If GUICtrlRead($iunits2) = "Ounces" Then $metric2temp = GUICtrlRead($munits2) If $metric2temp = "Kilograms" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*0.02835 & " kg") ElseIf $metric2temp = "Milligrams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*28350 & " mg") ElseIf $metric2temp = "Grams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*28.35 & " g") EndIf ElseIf GUICtrlRead($iunits2) = "Pounds" Then $metric2temp = GUICtrlRead($munits2) If $metric2temp = "Kilograms" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*0.4536 & " kg") ElseIf $metric2temp = "Milligrams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*453600 & " mg") ElseIf $metric2temp = "Grams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*453.6 & " g") EndIf ElseIf GUICtrlRead($iunits2) = "Stone" Then $metric2temp = GUICtrlRead($munits2) If $metric2temp = "Kilograms" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*6.5303 & " kg") ElseIf $metric2temp = "Milligrams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*6350300 & " mg") ElseIf $metric2temp = "Grams" Then GUICtrlSetData($metric2, GUICtrlRead($imperial2)*6350.3 & " g") EndIf Else GUICtrlSetData($metric2, "") EndIf ElseIf $type = 1 Then If GUICtrlRead($iunits2a) = "Ounces" Then $metric2atemp = GUICtrlRead($munits2a) If $metric2atemp = "Kilograms" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/0.02835 & " oz") ElseIf $metric2atemp = "Milligrams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/28350 & " oz") ElseIf $metric2atemp = "Grams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/28.35 & " oz") EndIf ElseIf GUICtrlRead($iunits2a) = "Pounds" Then $metric2atemp = GUICtrlRead($munits2a) If $metric2atemp = "Kilograms" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/0.4536 & " lbs") ElseIf $metric2atemp = "Milligrams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/453600 & " lbs") ElseIf $metric2atemp = "Grams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/453.6 & " lbs") EndIf ElseIf GUICtrlRead($iunits2a) = "Stone" Then $metric2atemp = GUICtrlRead($munits2a) If $metric2atemp = "Kilograms" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/6.5303 & " stone") ElseIf $metric2atemp = "Milligrams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/6350300 & " stone") ElseIf $metric2atemp = "Grams" Then GUICtrlSetData($metric2a, GUICtrlRead($imperial2a)/6350.3 & " stone") EndIf Else GUICtrlSetData($metric2a, "") EndIf EndIf EndFunc ;==>Mass tell me what you think and trans.au3 is expandcollapse popup#include <array.au3> Func GetLangArray($language) If $language = "UK English" Then local $i = 1 local $aLang[1] local $tempvar while 1 $tmpvar = IniRead(@ScriptDir & "\lang.lng","Data",$i, "e_r_r_0_r") $i += 1 if $tmpvar <> "e_r_r_0_r" Then _ArrayAdd($aLang,$tmpvar) Else ExitLoop EndIf WEnd Return $aLang ElseIf $language = "American English" Then local $i = 1 local $aLang[1] local $tempvar while 1 $tmpvar = IniRead(@ScriptDir & "\lang2.lng","Data",$i, "e_r_r_0_r") $i += 1 if $tmpvar <> "e_r_r_0_r" Then _ArrayAdd($aLang,$tmpvar) Else ExitLoop EndIf WEnd Return $aLang EndIf EndFunc imperial_metric.zip Download that it has all files in it including the two language files(can't upload here). After running read config.ini to change language Edited April 23, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 22, 2006 Share Posted April 22, 2006 (edited) DOH thought this was support forum Edited April 22, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
RazerM Posted April 22, 2006 Author Share Posted April 22, 2006 So what did you actually write lol. Anyway how is it? My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Infinitex0 Posted April 22, 2006 Share Posted April 22, 2006 (edited) It's very good, why don't you make it so you can convert something of the same system into something else. Or in understandable terms feet to inches and etc. Oh and I don't think that you spelled meters right (you have metres) Edited April 22, 2006 by Infinitex0 The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 22, 2006 Share Posted April 22, 2006 on tempurature you could add in kelvin Link to comment Share on other sites More sharing options...
RazerM Posted April 22, 2006 Author Share Posted April 22, 2006 i'm in the UK and it is definetely metre. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 22, 2006 Share Posted April 22, 2006 metre? metric? huh me·tre2 (mē'tər) pronunciation n. Chiefly British. Link to comment Share on other sites More sharing options...
Infinitex0 Posted April 23, 2006 Share Posted April 23, 2006 Just searched on wiki here turns out it's both. The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
RazerM Posted April 23, 2006 Author Share Posted April 23, 2006 (edited) i have added multilingual support thanks to libre's program. Put American English or UK English in the config.ini(it's generated after first run) Edited April 23, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. 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