Jump to content

Time


Scanzee
 Share

Recommended Posts

$sec = 0

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

GUICreate("Inloggen", 200, 200)

While 1

For $sec = 1 to 59 Step 1

$LabelID = GUICtrlCreateLabel($sec, 10, 30,)

Sleep(1000)

Next

GUISetState()

Wend

------------------------------------------------------------------

Whit this script you 're able to see the seconds like a stopwatch..

But here is the problem: If you use the script like above the seconds are counting but

they stay on de screen:(1,2,3,...) are at the same time on the screen.

I hope you understand my question and have a nice answer for me.

Thanks Scanzee Products<Scanzee@hotmail.com>

Link to comment
Share on other sites

  • Developers

maybe this will help you to get started:

$sec = 0

#include <GUIConstants.au3>
Opt("GUIOnEventMode",1)
GUICreate("Inloggen", 200, 200)
$LabelID = GUICtrlCreateLabel($sec, 10, 30)
GUISetState()
For $sec = 1 to 59 Step 1
    Sleep(1000)
    GUICtrlSetData($LabelID,$sec)
Next

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

here's an example i posted a while ago:

#include <GUIConstants.au3>
#include <Date.au3>
opt("TrayIconDebug", 1)
Global $Secs, $Mins, $Hour, $Time
;Create GUI
GUICreate("My Timer", 200, 200)
GUICtrlCreateLabel("00:00:00", "80", "80")
GUISetState()
;Start timer
$timer = TimerInit()
AdlibEnable("Timer", 50)
;
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
;
Func Timer()
    _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs)
    Local $sTime = $Time; save current time to be able to test and avoid flicker..
    $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    If $sTime <> $Time Then ControlSetText("My Timer", "", "Static1", $Time)
EndFunc  ;==>Timer
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

All problems are almost gone.. Just this one (I hope)..

$Minop = $Min

if $Minop = ($Minop + 4) Then

MsgBox(0,"MsgBox","Ready")

endif

I know this part of my script doesn't make any sens but I hope someone could help me out...

Link to comment
Share on other sites

Func Tijd()

For $sec = 0 to 59 Step 30

    If $sec < 10 Then
    $sec = "0" & $sec
    EndIf

If $Min = 59 And $Sec = 00 Then
$Min = -1
EndIf

If $sec = 00 Then
      Global $variable
      If Assign("variable", "Hello") Then  $Min = $Min + 1
    if $Min < 10 Then
    $Min = "0" & $Min
    endif
EndIf

If $Hour = 23 And $Min = 00 Then
$Hour = -1
      if $Day = 30 Then
      $Day = 0
      Global $variable
      If Assign("variable", "Hello") Then  $Month = $Month + 1
      endif

Global $variable
If Assign("variable", "Hello") Then  $Day = $Day + 1
EndIf

If $month = 13 Then
      $Month = 01
      Global $variable
      If Assign("variable", "Hello") Then  $Year = $Year + 1
EndIf

If $Min = 00 And $sec = 00 Then
      Global $variable
      If Assign("variable", "Hello") Then  $Hour = $Hour + 1
    if $Hour < 10 Then
    $Hour = "0" & $Hour
    endif
    if $Day < 10 And $Hour = 00 Then
    $Day = "0" & $Day
    endif
    if $Month = 01 And $Day = 01 Then
    $Month = "0" & $Month
    endif
EndIf



    Sleep(750)
    GUICtrlSetData($LabelTimeID,$Hour & ":" & $Min & ":" & $sec)
    GUICtrlSetData($LabelDateID,$Day & "/" & $Month & "/" & $Year)
    GUICtrlSetData($Label04ID,"Je hebt " & $gold & " Gold " & $Silverplate & " Silverplate " & $Silver &" Silver")
Next

EndFunc

This is my one timecalculation!!!!

Link to comment
Share on other sites

Hmm... why are you using Assign()?...

Perhaps it might be a good idea to step back. What is the logic of your entire script? What is its purpose? How would you describe all of its functionality in plain English (i.e. not as code)?

Link to comment
Share on other sites

do you want to run your script 24/7 the whole year? or why do you need months in your script?

i don't get your question (haven't found it in your code)

could you explain where you want to use that?

*Func Timedifrent: After 4 minutes (from my one timecalculation)

* MsgBox(...,"Msg","You are ready")

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...