Sign in to follow this  
Followers 0
Octave

2 key send with time interval

2 posts in this topic

Hi,

can someone tell me what is wrong with my loop, coz it seems to stop for a period of time and start again and most of the time it would miss sending the key(key send but no key input detected on the active window). this is for sending 1st key(key 9)repeatedly and 2nd key(key 1) is send in a time interval of 4min(240000).

WinActivate("window's title")

WinWaitActive("window's title")

sleep(3000)

$time = 1

while 1

If $time = 240 then send("1")

If $time = 240 then $time = 1

$time = $time + 1

sleep(500)

Send("9")

Send("9")

sleep(500)

WEnd

Share this post


Link to post
Share on other sites



Hi,

can someone tell me what is wrong with my loop, coz it seems to stop for a period of time and start again and most of the time it would miss sending the key(key send but no key input detected on the active window). this is for sending 1st key(key 9)repeatedly and 2nd key(key 1) is send in a time interval of 4min(240000).

Welcome to the forums octave!

Just before we get started, just a note to you: Please enclose your autoit code between autoit tags - this is the button beneath the bold button.

WinActivate("window's title")
 WinWaitActive("window's title")
 sleep(3000)
 $time = 1

while 1
    If $time = 240 Then ;Just enclose it in a whole if statement
             send("1")
         $time = 1
        EndIf

    $time += 1        ;same as $time = $time + 1
    sleep(500)
        Send("9")
    Send("9")
    sleep(500)
WEnd

That should do it, it looks pretty close anyway.

Please let me know how it is.

shanet


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

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