Jump to content

2 key send with time interval


Octave
 Share

Recommended Posts

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

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