Jump to content

How to read MSEC and make an action @ target value


Dunadan
 Share

Recommended Posts

Hello everyone! I'm pretty new at scripting, but i'm trying to make simple script which "reads" current time in milliseconds and makes an action when they are = or over 900.

What i need is a script that reads (without a GUI possibly) milliseconds and when they are 900~ it sends a send("{ENTER}") command. I've tried this, but it's not working :)

HotKeySet("{F3}", "end_script")

HotKeySet("{F2}", "check1")

HotKeySet("{F1}", "pause_script")

$systm_stw = 0

Sleep(3000)

AutoItSetOption("SendKeyDelay", 0000);

$msec=@MSEC

While 1 = 1

check1()

Wend

func check1()

if $msec = 900 then

send()

endif

endfunc

func send()

send("{ENTER}");

endfunc

func pause_script()

While ($systm_stw == 0)

WEnd

EndFunc

func end_script()

Exit

EndFunc

Also pause and restart script functions are not working, even if they worked with some other script i made....

Please some1 help me, i think it's not something hard to make for you!

Link to comment
Share on other sites

Please use AutoIt code tags -> Posted Image when posting AutoIt code.

Opt("SendKeyDelay", 0)

HotKeySet("{F3}", "end_script")
HotKeySet("{F2}", "check1")
HotKeySet("{F1}", "pause_script")
Sleep(3000)

Local $systm_stw = False, $msec = TimerInit()
$msec = @MSEC

While 1
    check1()
    Sleep(20)
WEnd

Func check1()
    If TimerDiff($msec) >= 900 Then
        $msec = TimerInit()
        _Send()
    EndIf
EndFunc   ;==>check1

Func _Send()
    Send("{ENTER}");
EndFunc   ;==>_Send

Func pause_script()
    $systm_stw = Not $systm_stw

    While $systm_stw
        Sleep(20)
    WEnd
EndFunc   ;==>pause_script

Func end_script()
    Exit
EndFunc   ;==>end_script
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...