Jump to content

count down clock


boltc
 Share

Recommended Posts

i want to make 5 differend counters in the same gui..

can someone give me a little bit help?

i have this now..

#NoTrayIcon
#include <GuiConstants.au3>
;

$counter = 200

$main_gui = GuiCreate("Test by Wake", 320, 134)

GuiCtrlCreateButton ("", 10000,10000,1,1)
$em = GuiCtrlCreateButton ("start", 10,10,50,20)
$exitbutton = GuiCtrlCreateButton ("exit", 10,40,50,20)


$main_gui = GUISetState()


While 1
    $msg = GUIGetMsg()
    


    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
        Case $msg = $EM
        $counter = $counter - 1
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
            

        Case $msg = $exitbutton
        GUIDelete()
        ExitLoop
            
        EndSelect
WEnd

Func QuitIt ()

  Exit

  Return
EndFunc

GUIDelete()

Exit

but it does not count down, only every time when i press the start button it will decrease with 1.. how can i fix this?

he need to decrease every 1 second by 1

Edited by boltc
Link to comment
Share on other sites

You needed a For Next Step statement. :lmao:

#NoTrayIcon
#include <GuiConstants.au3>
;

$counter = 200

$main_gui = GuiCreate("Test by Wake", 320, 134)

GuiCtrlCreateButton ("", 10000,10000,1,1)
$em = GuiCtrlCreateButton ("start", 10,10,50,20)
$exitbutton = GuiCtrlCreateButton ("exit", 10,40,50,20)


$main_gui = GUISetState()


While 1
    $msg = GUIGetMsg()
    


    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
        Case $msg = $EM
        For $q = 100 To 1 Step -1
        $counter = $counter - 1
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
        Next    

        Case $msg = $exitbutton
        GUIDelete()
        ExitLoop
            
        EndSelect
WEnd

Func QuitIt ()

  Exit

  Return
EndFunc

GUIDelete()

Exit

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

how can i stop the counter?

and if the counter has started, i cant close my gui any more:S

and i want to make different counters in the same gui.. is this possible?

Sure, put all of you code to update the counters between the For and the Sleep statements and in order to stop the script you will need a 'HOTKEY'

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

can you give me a little help with the hotkey?

Lookup the examples for HotKeySet in the help files. The show how to pause/unpause a script and how to exit using ESC.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

can you give me a little help with the hotkey?

#NoTrayIcon
#include <GuiConstants.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

$counter = 200

$main_gui = GuiCreate("Test by Wake", 320, 134)

GuiCtrlCreateButton ("", 10000,10000,1,1)
$em = GuiCtrlCreateButton ("start", 10,10,50,20)
$exitbutton = GuiCtrlCreateButton ("exit", 10,40,50,20)


$main_gui = GUISetState()


While 1
    $msg = GUIGetMsg()
    


    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
        Case $msg = $EM
        For $q = 200 To 1 Step -1
        $counter = $counter - 1
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
        Next    

        Case $msg = $exitbutton
        GUIDelete()
        ExitLoop
            
        EndSelect
WEnd

GUIDelete()

Exit

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func QuitIt ()

  Exit

  Return
EndFunc

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

Lookup the examples for HotKeySet in the help files. The show how to pause/unpause a script and how to exit using ESC.

Yep I used the examples from the help file in the script I just posted.

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

the pause and esc works now..

but i dont under stand this:

(i want to have more counters in the same gui..)

Ah, you code to update your other counters you will need to place them between the for and sleep statements that way your counters all count at the same time. I think your problem will be if you step them faster than - 1 or if some counters have to sleep longer than 1 second. Try your code out and paste back in the post if it doesnt work. we will get you up and running.

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

i have this now:

#NoTrayIcon
#include <GuiConstants.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

$counter = 200
$counter1 = 100

$main_gui = GuiCreate("Test by Wake", 320, 134, -1, -1, -1, $WS_EX_TOPMOST)

GuiCtrlCreateButton ("", 10000,10000,1,1)
$em = GuiCtrlCreateButton ("start", 10,10,50,20)
$em1 = GuiCtrlCreateButton ("start", 10,40,50,20)
$exitbutton = GuiCtrlCreateButton ("exit", 10,70,50,20)


$main_gui = GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()



    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
        Case $msg = $EM
        For $q = 200 To 1 Step -1
        $counter = $counter - 1
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
        Next    

        Case $msg = $EM1
        For $q = 200 To 1 Step -1
        $counter1 = $counter1 - 1
        sleep(1000)
        GuiCtrlCreateInput($counter1, 70, 40, 130, 20)
        next

        Case $msg = $exitbutton
        GUIDelete()
        ExitLoop
            
        EndSelect
WEnd


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func QuitIt ()

  Exit

  Return
EndFunc


GUIDelete()

Exit

the problem is, he first counter that i want to start will work, and the other one does nothing when i try to start him...

Link to comment
Share on other sites

Try it like this

#NoTrayIcon
#include <GuiConstants.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

$counter = 200
$counter1 = 100

$main_gui = GuiCreate("Test by Wake", 320, 134, -1, -1, -1, $WS_EX_TOPMOST)

GuiCtrlCreateButton ("", 10000,10000,1,1)
$em = GuiCtrlCreateButton ("start", 10,10,50,20)
$exitbutton = GuiCtrlCreateButton ("exit", 10,70,50,20)


$main_gui = GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()



    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
        Case $msg = $EM
        For $q = 200 To 1 Step -1
        $counter = $counter - 1
        $counter1 = $counter1 - 1
        If $counter1 < 0 Then $counter1 = 0
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
        GuiCtrlCreateInput($counter1, 70, 40, 130, 20)
        Next    

        Case $msg = $exitbutton
        GUIDelete()
        ExitLoop
            
        EndSelect
WEnd


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func QuitIt ()

  Exit

  Return
EndFunc


GUIDelete()

Exit
Edited by flaxcrack

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

i try to explain but im not the best in english...

i start counter 1 now..

some seconds later i want to start counter 2..

enough?

Check out this snippt

For $q = 200 To 1 Step -5
        $counter = $counter - 1
        For $p = 3 To 1 Step - 1
        $counter1 = $counter1 - 1
        If $counter1 < 0 Then $counter1 = 0
        Next
        sleep(1000)
        GuiCtrlCreateInput($counter, 70, 10, 130, 20)
        GuiCtrlCreateInput($counter1, 70, 40, 130, 20)
        Next

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
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
 Share

  • Recently Browsing   0 members

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