Sign in to follow this  
Followers 0
Moras

Help With Repeating Timer

5 posts in this topic

#1 ·  Posted (edited)

ok it may be that im very tired :think: but how do i make this script repeat itself if i use a continuos loop it just repeats the clicking part

opps ok complete scritp there now :( dont know why i didnt post it all first time

#include <GUIConstants.au3>

#include <Date.au3>

Global $Secs, $Mins, $Hour, $Time, $InitialT, $TargetT

GUICreate("Timer", 200, 100)

$MinIn = GUICtrlCreateInput("00", 70, 10, 30, 20, $ES_NUMBER)

$label = GUICtrlCreateLabel(":", 101, 12)

$SecIn = GUICtrlCreateInput("00", 105, 10, 30, 20, $ES_NUMBER)

$start = GUICtrlCreateButton("Start", 75, 50, 50, 30)

$timeLabel = GUICtrlCreateLabel("00:00:00", 80, 20)

GUICtrlSetState($timeLabel, $GUI_HIDE)

GUISetState(@SW_SHOW)

$started = 0

While 1

;After every loop check if the user clicked something in the GUI window

$msg = GUIGetMsg()

Select

;Check if user clicked on the close button

Case $msg = $GUI_EVENT_CLOSE

;Destroy the GUI including the controls

GUIDelete()

ExitLoop

Case $msg = $start

If GUICtrlRead($start) == "Start" Then

StartTimer()

Else

StopTimer()

EndIf

EndSelect

WEnd

Exit

Func StartTimer()

GUICtrlSetData($start, "Stop")

GUICtrlSetState($MinIn, $GUI_HIDE)

GUICtrlSetState($label, $GUI_HIDE)

GUICtrlSetState($SecIn, $GUI_HIDE)

GUICtrlSetState($timeLabel, $GUI_SHOW)

$InitialT = TimerInit()

$TargetT = (GUICtrlRead($MinIn) * 60 + GUICtrlRead($SecIn)) *1000

AdlibEnable("Timer")

EndFunc ;==>StartTimer

Func StopTimer()

GUICtrlSetData($start, "Start")

GUICtrlSetState($MinIn, $GUI_SHOW)

GUICtrlSetState($label, $GUI_SHOW)

GUICtrlSetState($SecIn, $GUI_SHOW)

GUICtrlSetState($timeLabel, $GUI_HIDE)

AdlibDisable()

EndFunc ;==>StartTimer

Func Timer()

$TimeLeft = $TargetT - TimerDiff($InitialT)

If $TimeLeft > 0 Then

_TicksToTime(Int($TimeLeft), $Hour, $Mins, $Secs)

; save current time to be able to test and avoid flicker..

Local $sTime = $Time

$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)

If $sTime <> $Time Then GUICtrlSetData($timeLabel, $Time)

Else

MouseClick("left")

EndIf

EndFunc ==>

Edited by Moras

Share this post


Link to post
Share on other sites



HI,

could please post the complete script.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

is it also possible to get the time to randomly stop at an interval say 2 secs more than that of the time i enter? say i enter 10 secs and it will click the mouse button at random times between the 10 and 12 secs?

i couldnt see anything about that in the timers section of the help :think:

Share this post


Link to post
Share on other sites

bump

anyone?

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