Jump to content

Recommended Posts

Excample :

#include <Date.au3>
HotKeySet("{ESC}", "_Quit") ; just to quit the script manually

Local $sTimeToClick = "08:12:00" ; HH:MM:SS
While True
    If _NowTime() = $sTimeToClick Then
        MsgBox(0, "Clicktime", _NowTime())
        ExitLoop
    EndIf
    Sleep(10)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

P.S. : Next time please post the script, not just a graphic of it ;).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

by the way this was my code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("", 200, 90)
$label1 = GUICtrlCreateLabel ("", 10, 10,100,100)
$label2 = GUICtrlCreateLabel ("", 40, 10,100,100)
$label3 = GUICtrlCreateLabel ("", 70, 10,100,100)
$label4 = GUICtrlCreateLabel ("", 100, 10,100,100)

Func click()
             MouseClick("left",230,468,1,1)
EndFunc

GUISetState(@SW_SHOW)
While 1
    $hour = @hour
    $min = @MIN
    $sec = @SEC
    $msec = @MSEC

   if $hour=="10" And $min== "15" And $sec== "20" And  "995"<$msec<"999" Then
         click()
      Break
    EndIf

    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    GUICtrlSetData($label1, $hour)
    GUICtrlSetData($label2, $min)
    GUICtrlSetData($label3, $sec)
    GUICtrlSetData($label4, $msec)
 WEnd

 

Edited by Jos
added codebox
Link to post
Share on other sites
  • Developers
14 minutes ago, hoomantop said:

And  "995"<$msec<"999" Then

This is not giving you the result you expect and need to be broken up in 2 parts!

if $hour = 10 And $min = 15 And $sec = 20 And 995 < $msec And $msec < 999 Then

Jos

Edited by Jos

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 post
Share on other sites

 

2 hours ago, hoomantop said:

by the way this was my code:

The assigned time range for milliseconds is too narrow (995..999). The function GUIGetMsg already generates a sleep of 10 ms (as far as I know). Because of that, this partial condition is often not fulfilled.

BTW : Do you really need to check for milliseconds?

Furthermore : Why do you use the function Break ? In addition, the syntax for Break is incorrect !

Here is an example according to your sample including the correction of @Jos :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "_Quit") ; just to quit the script manually

$gui      = GUICreate("", 200, 90)
$label1   = GUICtrlCreateLabel("", 10, 10, 100, 100)
$label2   = GUICtrlCreateLabel("", 40, 10, 100, 100)
$label3   = GUICtrlCreateLabel("", 70, 10, 100, 100)
$label4   = GUICtrlCreateLabel("", 100, 10, 100, 100)
$bClicked = False

Func click()
    MouseClick("left", 230, 468, 1, 1)
EndFunc   ;==>click

GUISetState(@SW_SHOW)

While 1
    $hour = @HOUR
    $min  = @MIN
    $sec  = @SEC
    $msec = @MSEC

    if $hour = 17 And $min = 34 And $sec = 5 And 599 < $msec And $msec < 999 AND NOT $bClicked Then
        ConsoleWrite($hour & ':' & $min & ':' & $sec & '.' & $msec & @CRLF) ; *** just for test
        click()
        $bClicked = True
;~      Break
    EndIf

    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect

    Sleep(50)
    GUICtrlSetData($label1, $hour)
    GUICtrlSetData($label2, $min)
    GUICtrlSetData($label3, $sec)
    GUICtrlSetData($label4, $msec)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites
12 hours ago, Musashi said:

 

The assigned time range for milliseconds is too narrow (995..999). The function GUIGetMsg already generates a sleep of 10 ms (as far as I know). Because of that, this partial condition is often not fulfilled.

BTW : Do you really need to check for milliseconds?

Furthermore : Why do you use the function Break ? In addition, the syntax for Break is incorrect !

Here is an example according to your sample including the correction of @Jos :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "_Quit") ; just to quit the script manually

$gui      = GUICreate("", 200, 90)
$label1   = GUICtrlCreateLabel("", 10, 10, 100, 100)
$label2   = GUICtrlCreateLabel("", 40, 10, 100, 100)
$label3   = GUICtrlCreateLabel("", 70, 10, 100, 100)
$label4   = GUICtrlCreateLabel("", 100, 10, 100, 100)
$bClicked = False

Func click()
    MouseClick("left", 230, 468, 1, 1)
EndFunc   ;==>click

GUISetState(@SW_SHOW)

While 1
    $hour = @HOUR
    $min  = @MIN
    $sec  = @SEC
    $msec = @MSEC

    if $hour = 17 And $min = 34 And $sec = 5 And 599 < $msec And $msec < 999 AND NOT $bClicked Then
        ConsoleWrite($hour & ':' & $min & ':' & $sec & '.' & $msec & @CRLF) ; *** just for test
        click()
        $bClicked = True
;~      Break
    EndIf

    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect

    Sleep(50)
    GUICtrlSetData($label1, $hour)
    GUICtrlSetData($label2, $min)
    GUICtrlSetData($label3, $sec)
    GUICtrlSetData($label4, $msec)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

 

thank you so much

yes i need to click in miliseconds, but the problem is that it clicks 1 sec before the condition . my condition was at minute 51 and second 00, but it clicks at minute 50 and second 59. 

and yes the break was wrong but i tried to make an error to see the exact time it execute. i will try your code and tell the result .

again i appreciate.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...