Sign in to follow this  
Followers 0
Scanzee

Time

13 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

That problem is gone but.. Here is some other..

If the seconds are < 10 Then the computer shows 1,2,3,...

But The computer has to show 01,02,03 what do I have to do?!

Thanks

Share this post


Link to post
Share on other sites

You can add a 0 to the display like with this example

For $i = 1 To 59
    MsgBox(0, '', StringRight('0' & $i, 2), 1)
Next

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


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

Share this post


Link to post
Share on other sites

I don't know what to do with this..

Do someone have a idea?!

Need help..

Share this post


Link to post
Share on other sites

I would suggest posting the logic of your script, which is needed before any code can be written. Example:

  • Wait for 4 minutes.
  • Show a ready message.

Share this post


Link to post
Share on other sites

Is this what you mean?

*I 'm using some time calculation like above...

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

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

It has to be something like this!

Share this post


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

Share this post


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

Share this post


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

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