Jump to content
Sign in to follow this  
Dunadan

How to read MSEC and make an action @ target value

Recommended Posts

Dunadan

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!

Share this post


Link to post
Share on other sites
Authenticity

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

Share this post


Link to post
Share on other sites
Dunadan

Sorry for not using tags!

Thank you for the script, it rocks! It seems it'll take me some time to study how it works! Thanks for help, yuo solved me a huge problem ^^

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  

×