Sign in to follow this  
Followers 0
boltc

count down clock

16 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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?

Edited by boltc

Share this post


Link to post
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()

Share this post


Link to post
Share on other sites

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'

can you give me a little help with the hotkey?

Share this post


Link to post
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.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
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()

Share this post


Link to post
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()

Share this post


Link to post
Share on other sites

the pause and esc works now..

but i dont under stand this:

Sure, put all of you code to update the counters between the For and the Sleep statements

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

Share this post


Link to post
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()

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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()

Share this post


Link to post
Share on other sites

gehe next problem:

i need to start then @ diffrent times..

it starts to get hard isnt it?;):lmao:

Share this post


Link to post
Share on other sites

gehe next problem:

i need to start then @ diffrent times..

it starts to get hard isnt it?;):lmao:

That shouldn't be a problem, explain what you mean...


[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()

Share this post


Link to post
Share on other sites

That shouldn't be a problem, explain what you mean...

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?

Share this post


Link to post
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()

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