Send to ControlSend

Recommended Posts

boshi 0

boshi 0

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