Jump to content

How To Prevent Autoit Changing Window Focus?


Recommended Posts

Hi, I've been working (slowly and painfully) on making a script to adjust the download rate limit in DU Super Controler (like netlimiter) depending on how congested the connection is.

That way my flatmates can run their annoying p2p apps and I can play my games faster than a slideshow.

The problem is, every time the script executes the ControlSend and ControlSetText functions, it changes the window focus, which screws around with whatever I'm doing at the time, eg it minimizes any fullscreen game.

What I want is a way to change the number on DU Super Controler without minimizing my game.

Any suggestions? I've found a few topics on this in search but haven't found a definitive answer...

AutoItSetOption ( "TrayIconHide", 1 )
$Speed = 30

While 1
  $Latency = 0

; get a non-zero ping
  While $Latency = 0
    $Latency = Ping("www.google.co.nz")
    sleep(1000)
  WEnd

; if ping is too high then reduce speed
  if $Latency > 350 then
    $Speed = $Speed - 5
  endIf

; if ping is low enough then increase speed
  if $Latency < 300 then
    $Speed = $Speed + 2
  endIf


; keep the speed within limits
  if $Speed < 10 then
    $Speed = 10
  endIf

  if $Speed > 32 then
    $Speed = 32
  endIf

; update DU Super Controler with the new speed
  ControlSetText ( "DU Super Controler", "", "Edit4", $Speed & "k")
  ControlSend ( "DU Super Controler", "", "Edit4", "{Enter}")

; wait for 2 minutes before repeating
  sleep(120000)

WEnd

Cheers

Edited by stormwarden
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...