Sign in to follow this  
Followers 0
James

Time Conversion

5 posts in this topic

#1 ·  Posted (edited)

Howdy,

My friend wanted a time converter between: Milliseconds, seconds and minutes so he could program Sleep fucntions etc on the fly.

For some reason once I had made it he said he wanted the Google logo on it :) so as the kind, gentle, young caring man I am, I did it for him :D

#include <GUIConstants.au3>

_GetImage()

$sGui = GUICreate("Time Conversion", 462, 100, -1, -1)
GUISetBkColor (0xFFFFFF)
$Google = GUICtrlCreatePic("C:\temp.gif", 0, 0,0,0)
$MilliSecs = GUICtrlCreateInput("MilliSeconds", 32, 8, 169, 21)
$Seconds = GUICtrlCreateInput("Seconds", 32, 40, 169, 21)
$Mins = GuiCtrlCreateInput("Corrected Seconds", 32, 70, 169, 21)
$Convert = GUICtrlCreateButton("Convert", 216, 8, 73, 25, 0)
$Clear = GUICtrlCreateButton("Clear", 376, 8, 73, 25, 0)
$Exit = GUICtrlCreateButton("Exit", 296, 8, 73, 25, 0)
GUISetState(@SW_SHOW, $sGui)
GUISetState(@SW_DISABLE, $Google)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Exit
            Exit
        Case $Convert
            _Convert()
        Case $Clear
            GuiCtrlSetData($MilliSecs, "")
            GUICtrlSetData($Seconds, "")
            GuiCtrlSetData($Mins, "")
    EndSwitch
WEnd

Func _Convert()
    $Milli = GuiCtrlRead($Millisecs)
    $Secs = GuiCtrlRead($Seconds)
    GuiCtrlSetData($Seconds, $Milli * 0.001)
    GuiCtrlSetData($Mins, $Milli * 0.000016666666666666667)
EndFunc

Func _GetImage()
    If FileExists("C:\temp.gif") Then
        ;
    Else
        InetGet("http://www.google.co.uk/intl/en_uk/images/logo.gif", "C:\temp.gif", 1)
    EndIf
EndFunc

So, I thought I would post it here for some other person who wants to convert it on the fly.

Secure

Edit: Some random problem with uploading the code

Edited by Secure_ICT

Share this post


Link to post
Share on other sites



I think thats doubled:

Exit
        Case $Convert
            _Convert()
        Case $Clear
            GuiCtrlSetData($MilliSecs, "")
            GUICtrlSetData($Seconds, "")
            GuiCtrlSetData($Mins, "")
    EndSwitch
WEnd

Func _Convert()
    $Milli = GuiCtrlRead($Millisecs)
    $Secs = GuiCtrlRead($Seconds)
    GuiCtrlSetData($Seconds, $Milli * 0.001)
    GuiCtrlSetData($Mins, $Milli * 0.000016666666666666667)
EndFunc

Share this post


Link to post
Share on other sites

I think he means in the _GetImage() function, it all of a sudden tries to check for cases just like it does in your While loop at the beginning of the script, while it probably should just be removed. Even your line to end that function ends with EndFuncExit, like something messed up posting it.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0