Jump to content

Send to ControlSend


Recommended Posts

I just found AutoIt by accidence and I think AutoIt is a good place to learn new things. Recently I created a script for my favourite game and I have some problem. I tried to use it when the window is inactive using ControlSend function but seems all messed up. Can anyone help me to convert my script to make it useable for inactive window, Here is the code:

CODE
$Topup = 0

Hotkeyset ( "e", "exit1")

winmove ( "Game", "", 1, 1 )

while 1 = 1

If PixelGetColor ( 168, 528 ) = 2101304 then topup()

If PixelGetColor ( 168, 528 ) > 2101304 then strafe()

wend

Func Topup()

If PixelGetColor ( 657, 565 ) < 16317688 then

Send ( "{z down}", 0 )

Send ( "{LCTRL down}", 0 )

Send ( "{z up}", 0 )

Send ( "{LCTRL up}", 0 )

MouseMove ( 597, 423, 10000000 )

MouseClick ( "left", 597, 423 )

Sleep ( 1 )

MouseMove ( 691, 279, 10000000 )

MouseClick ( "left", 691, 279 )

Sleep ( 1 )

MouseMove ( 597, 423, 10000000 )

Else

MouseMove ( 597, 423, 10000000 )

EndIf

endfunc

func Strafe()

; do nothing

endfunc

func exit1()

Exit (0)

endfunc

Perhaps someone can help me convert this and fix any mistakes.Your hel is greatly appreciated. Tq

Link to comment
Share on other sites

Hi,

just have a look at the helpfile for ControlSend and ControlSetText and use Autoit Window Info to get the title and text and ControlID.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I have used the AutoIt Window Info but return nothing on my game..

The controlID is a problem because I could not figure out what it is.

ok. Thanx for the reply, i wanna try it

Link to comment
Share on other sites

I have use this code but seems a problem. I could use ControlSend function but I could not figure out what is wrong with my ControlClick function

If PixelGetColor ( 657, 565 ) < 16317688 then 
    ControlSend ( "Game", "", "", "{z down}", 0 )
    ControlSend ( "Game", "", "", "{LCTRL down}", 0 )
    ControlSend ( "Game", "", "", "{z up}", 0 )
    ControlSend ( "Game", "", "", "{LCTRL up}", 0 )
    
    ControlClick ( "Game", "", "", "left", 1, 597, 423 )
    Sleep ( 1 )

    ControlClick ( "Game", "", "", "left", 1, 691, 279 )
    Sleep ( 1 )

Anyone know how I can press CTRL+Z rather than what I am using now? I know about ^z but it just don't work. Really appreciated your response. Thanks

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...