Sign in to follow this  
Followers 0
DaProgrammer

Time Calculator

9 posts in this topic

#1 ·  Posted (edited)

Ever needed to Calculate how much time are all 3 movies together and started to multiply the hours *3600 and the minutes *60, well no more.

I present to you the time calculator.

Opt("GUIOnEventMode",1)
GuiCreate("KJ's TC", 130, 70,-1, -1)
GUISetOnEvent(-3,"Exitt")

GUICtrlCreateLabel(":",33,12,15,15)
GUICtrlCreateLabel(":",63,12,15,15)
GUICtrlCreateLabel(":",33,42,15,15)
GUICtrlCreateLabel(":",63,42,15,15)
$Input_h1 = GuiCtrlCreateInput("", 10, 10, 20, 20)
$Input_m1 = GuiCtrlCreateInput("", 40, 10, 20, 20)
$Input_s1 = GuiCtrlCreateInput("", 70, 10, 20, 20)
$Input_h2 = GuiCtrlCreateInput("", 10, 40, 20, 20)
$Input_m2 = GuiCtrlCreateInput("", 40, 40, 20, 20)
$Input_s2 = GuiCtrlCreateInput("", 70, 40, 20, 20)
$Button_a = GuiCtrlCreateButton("+", 100, 5, 15, 15)
$Button_s = GuiCtrlCreateButton("-", 100, 25, 15, 15)
$Button_r = GuiCtrlCreateButton("R", 100, 45, 15, 15)

GUICtrlSetOnEvent($Button_a,"Add")
GUICtrlSetOnEvent($Button_s,"Subtract")
GUICtrlSetOnEvent($Button_r,"Reset")

GuiSetState()
While 1
Sleep(1000)
WEnd

Func Add()
    GUICtrlSetData($Input_s1,GUICtrlRead($Input_s1)+GUICtrlRead($Input_s2))
    GUICtrlSetData($Input_s2,"")
    While GUICtrlRead($Input_s1)>=60
        GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)+1)
        GUICtrlSetData($Input_s1,GUICtrlRead($Input_s1)-60)
    WEnd
    
    GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)+GUICtrlRead($Input_m2))
    GUICtrlSetData($Input_m2,"")
    While GUICtrlRead($Input_m1)>=60
        GUICtrlSetData($Input_h1,GUICtrlRead($Input_h1)+1)
        GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)-60)
    WEnd
    
    GUICtrlSetData($Input_h1,GUICtrlRead($Input_h1)+GUICtrlRead($Input_h2))
    GUICtrlSetData($Input_h2,"")
EndFunc

Func Subtract()
    GUICtrlSetData($Input_s1,GUICtrlRead($Input_s1)-GUICtrlRead($Input_s2))
    GUICtrlSetData($Input_s2,"")
    While GUICtrlRead($Input_s1)<0
        GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)-1)
        GUICtrlSetData($Input_s1,GUICtrlRead($Input_s1)+60)
    WEnd
    
    GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)-GUICtrlRead($Input_m2))
    GUICtrlSetData($Input_m2,"")
    While GUICtrlRead($Input_m1)<0
        GUICtrlSetData($Input_h1,GUICtrlRead($Input_h1)-1)
        GUICtrlSetData($Input_m1,GUICtrlRead($Input_m1)+60)
    WEnd
    
    GUICtrlSetData($Input_h1,GUICtrlRead($Input_h1)-GUICtrlRead($Input_h2))
    GUICtrlSetData($Input_h2,"")
EndFunc

Func Reset()
    GUICtrlSetData($Input_h1,"")
    GUICtrlSetData($Input_m1,"")
    GUICtrlSetData($Input_s1,"")
    GUICtrlSetData($Input_h2,"")
    GUICtrlSetData($Input_m2,"")
    GUICtrlSetData($Input_s2,"")
EndFunc

Func Exitt()
    Exit
EndFunc
Edited by DaProgrammer

Share this post


Link to post
Share on other sites



Cool, may I suggest a reset button, and a close either on top right corner or elswhere.. :) Very good start or tidbit for another script.

Share this post


Link to post
Share on other sites

Cool, may I suggest a reset button, and a close either on top right corner or elswhere.. :) Very good start or tidbit for another script.

Done ;)


Share this post


Link to post
Share on other sites

Sweet! Nice improvements... Did you build this for another project or just like me kinda wandering around doing a bit here and there for fun?

Share this post


Link to post
Share on other sites

Sweet! Nice improvements... Did you build this for another project or just like me kinda wandering around doing a bit here and there for fun?

i made a couple of projects, some of which u can find by following my sig. but mainly thinking of ideas for a big project and plying around in the meantime.


Share this post


Link to post
Share on other sites

Nice, I like the simplicity of it.

One suggestion, modify the tray icon or get rid of it.

its a tool to work with and an idea for others to implement i didnt bother to make it pretty and stuff, if u want pretty follow my sig and download the alarm clock its what u might call a finished product, published on Download.com(C.Net)


Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

:) Have'nt tried yours yet, but here's a version I quickly knocked up some time ago

Time Calculator v1.5

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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