Sign in to follow this  
Followers 0
merulz

Quick Question

8 posts in this topic

Is it possible to send commands to a window instead of waiting for that window to be active?

Share this post


Link to post
Share on other sites



you first need to confirm it is there, then you can send any command to that window


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Okay, so if I understand you correctly, I need to target the window so that AutoIt can confirm it's there? How would I go about doing this?

Sorry for the questions, I'm brand new to AutoIt :P

Share this post


Link to post
Share on other sites

WinExist, read the help file it is one of the most resourceful things


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Okay, I think I got it now. What I'm trying to do is make the script loop endlessly. I checked here but am confused about which one would be used for my need.

Here's my script so far:

If WinExists("Element Client")
    Then
    Send{+[1]} ;targets party member #1
    Sleep("1000") ;waits a second
    Send{[F2]} ;change this to your hotkey for heal
    Sleep("1000")
    Send{+[2]} ;targets party member #2
    Sleep("1000")
    Send{[F2]} ;change this to your hotkey for heal
    Sleep("1000")
    Send{+[3]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[4]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[5]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")

Share this post


Link to post
Share on other sites

While 1
If WinExists("Element Client") Then
    Send{+[1]};targets party member #1
    Sleep("1000");waits a second
    Send{[F2]};change this to your hotkey for heal
    Sleep("1000")
    Send{+[2]};targets party member #2
    Sleep("1000")
    Send{[F2]};change this to your hotkey for heal
    Sleep("1000")
    Send{+[3]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[4]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[5]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
EndIf
Wend

By using while 1 (always true) it will continuously loop through the script. Also remember to close all open statements like your If (EndIf) and While (Wend).

Hope this helps,

Regards

Share this post


Link to post
Share on other sites

CODE
While 1

If WinExists("elementclient") Then

Winactivate("elementclient")

Send{+[1]};targets party member #1

Sleep("1000");waits a second

Send{[F2]};change this to your hotkey for heal

Sleep("1000")

Send{+[2]};targets party member #2

Sleep("1000")

Send{[F2]};change this to your hotkey for heal

Sleep("1000")

Send{+[3]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

Send{+[4]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

Send{+[5]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

EndIf

Wend

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Take a look at this, I cleaned up your code a bit.

While 1
    If WinExists("elementclient") Then
        WinActivate("elementclient")
        For $i = 1 To 5
            Send("+{" & $i & "}")
            Sleep(1000)
            Send("{F2}")
            Sleep(1000)
        Next
    EndIf
WEnd

And about your first question, take a look at ControlSend().

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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