Jump to content

Recommended Posts

Posted (edited)

What's wrong in this script? I can not make it work.

Thanks!

Global $Runner

HotKeySet("{F9}", "ShowMe")
AutoItSetOption("WinTitleMatchMode", 4) 
;Global $handle = WinGetHandle("classname=Client Window")
Global $handle = "0x000E02CE"

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        ToolTip('Script is "Started"',0,0)
     ; To hold a key down (generally only useful for games)
        ControlSend($handle, "", "", "{SPACE DOWN}")
     ;Send("{SPACE DOWN}")
        Sleep(3000); 5 seconds
        ControlSend($handle, "", "", "{SPACE UP}")
     ;Send("{SPACE UP}")
        Sleep(30000); 10 seconds
    WEnd
EndFunc
Edited by Fabroni
Posted

Maybe you sould try to explain how do you expect it to work.

but try this:

Global $Runner = False

and this

Sleep(3000); 5 seconds

is in fact 3 seconds, not 5.

and where did you found this value?

Global $handle = "0x000E02CE"

cheers

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Posted (edited)

  Linux said:

Maybe you sould try to explain how do you expect it to work.

but try this:

Global $Runner = False

and this

Sleep(3000); 5 seconds

is in fact 3 seconds, not 5.

and where did you found this value?

Global $handle = "0x000E02CE"

cheers

I tried Global $Runner = False but still no.

I have handle control below from one program. And I am making script to work for only this program. Its window is supposed tp be minimized to taskbar.

Global $handle = "0x000E02CE"
Edited by Fabroni
Posted

why dont use sendkeepactive?

Global $Runner = False
HotKeySet("{F9}", "ShowMe")

Func ShowMe()
    HotKeySet("{F9}", "Paused")
    SendKeepActive($handle)
    ToolTip('Script is "Started"',0,0)
  Do
   Send("{SPACE DOWN}")
        Sleep(3000); 5 seconds
   Send("{SPACE UP}")
        Sleep(30000); 10 seconds
  Until $Runner = True
EndFunc

Func Paused()
    $Runner = True
    HotKeySet("{F9}", "ShowMe")
    while $Runner
        sleep(10)
        ConsoleWrite("Paused!"&@CRLF)
    WEnd
EndFunc

also how and where did you get the value of $handle?

Posted

  LiLShinta said:

why dont use sendkeepactive?

Global $Runner = False
HotKeySet("{F9}", "ShowMe")

Func ShowMe()
    HotKeySet("{F9}", "Paused")
    SendKeepActive($handle)
    ToolTip('Script is "Started"',0,0)
  Do
   Send("{SPACE DOWN}")
        Sleep(3000); 5 seconds
   Send("{SPACE UP}")
        Sleep(30000); 10 seconds
  Until $Runner = True
EndFunc

Func Paused()
    $Runner = True
    HotKeySet("{F9}", "ShowMe")
    while $Runner
        sleep(10)
        ConsoleWrite("Paused!"&@CRLF)
    WEnd
EndFunc

also how and where did you get the value of $handle?

I really appreciate your help but I am looking for away to send key to inactive window (minimized) game. I got $handle after using Au3Info on that game.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...