Jump to content

Detecting dynamic ControlID and high priority keypress


Recommended Posts

Hi, I started using AutoIt for a macro/bot I need last night and I've been having problems with the current efficiency of the program compared to how well I'd like it to perform ideally.

The program I'm trying to send keypresses to generates a controlID upon runtime.

I want to let the macro do its magic while the program is minimized but I do not want to have to run the program then rescript the macro everytime so I'd ask for advice on how to detect it (similar to process IDs retrieved in C# by using calls to EnumWindows, GetWindowThreadProcessId, and GetClassName).

I'd also like some help making the keypress override any other keypresses issued at the same time frame (for instance, I am using another bot in addition to the one below but sometimes the time it takes to use a certain skill in the game spans over 1~2000 milliseconds or more.

I want the macro below to be able to override any buttons issued around the same time or to be put in cue to be activated immediately after the skill currently in progress had been completed). Included below is the code I'm referring to, all help is appreciated! :(

Global $UnPaused
HotKeySet("9", "TogglePause")
HotKeySet("{ESC}", "Terminate")

While("9")
    Sleep(100)
    ToolTip("Script is Paused",0,0)
WEnd

Func TogglePause()
    $UnPaused = NOT $UnPaused
    While $UnPaused
                ToolTip("Sending...",0,0)

Local $x = 6000 ; 
Local $y = 4700;

Send("{left}")
Sleep($x)
Send("{left}")
Sleep($y)
Send("{left}")
Sleep(1000)
Send("{left}")
Sleep(1000)
Send("{right}")
Sleep($x)
Send("{right}")
Sleep($y)
Send("{right}")
Sleep(1000)
Send("{right}")
Sleep(1000)
Wend
EndFunc

Func Terminate()
    Exit 0
EndFunc
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...