Global $n, $hwnd
Global $gametitle="Van Mai"
Global $Pause = 0
HotKeySet("{F11}","TogglePause")
HotKeySet("!{ESC}","Terminate")
;Opt("SendCapslockMode", 0)
Opt("SendKeyDelay", 5) ;9 milliseconds
Opt("SendKeyDownDelay", 5) ;9 millisecond
Opt("WinTitleMatchMode",2)
Opt("MouseCoordMode",2)
Opt("PixelCoordMode",2)
While Not $Pause
WinActivate("UID")
ControlClick("UID","","","left",1,781,522) ;
Sleep(300) ;
ControlClick("UID","","","left",1,613,486) ; kich hoạt auto run
Sleep(300) ;
ControlClick("UID","","","left",1,781,522) ;
$aWin=WinList($gametitle)
$clhwnd = WinGetHandle("UID")
$startime = 0
$endtime = 0
While $endtime < 2399
;If WinActive($gametitle) Then
$color = PixelGetColor(639,43,$clhwnd) ;lay mau tai vi tri 764,32 de so sanh co vao tran hay chua
;ToolTip(" = "&$aWin[0][0],0,0)
If $color = 7170120 Then
For $n = 1 To $aWin[0][0]
ControlSendPlus($aWin[$n][1],"","","!q",4)
ControlSendPlus($aWin[$n][1],"","","!q",4)
Next
EndIf
;EndIf
Sleep(1500); Thá»i gian dừng giữa cĂ¡c lần send key (tui để 1000 tuy hÆ¡i nhanh nhưng sẽ Ä‘Ă¡nh trong tầm giĂ¢y thứ 19 vĂ 20 đỡ mất thá»i gian chá»)
$endtime += 1
WEnd
Sleep(120000) ; ChỠ2' sau khi hết 1h autorun cho cho chắc ăn :D
WEnd
Func TogglePause()
$Pause = NOT $Pause
While $Pause
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func Terminate()
MsgBox(0,"Bye bye","Auto Co Long Online by HEROSE")
Exit
EndFunc
Func ControlSendPlus($title, $text, $className, $string, $flag)
;VERSION 2.0.3 (06/13/2004)
Local $ctrl=0,$alt=0,$upper,$start,$end,$i,$char,$and,$Chr5Index,$isUpper,$ret
If $flag = 2 OR $flag = 3 Then $ctrl = 1
If $flag = 2 OR $flag = 4 Then $alt = 1
If $flag <> 1 Then $flag = 0;set the flag to the default function style
$upper = StringSplit('~!@#$%^&*()_+|{}:"<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ', "")
If $flag <> 1 Then;don't replace special chars if it's raw mode
;replace {{} and {}} with +[ and +] so they will be displayed properly
$string = StringReplace($string, "{{}", "+[")
$string = StringReplace($string, "{}}", "+]")
;replace all special chars with Chr(5)
;add the special char to an array. each Chr(5) corresponds with an element
Local $Chr5[StringLen($string) / 2 + 1]
For $i = 1 To StringLen($string)
$start = StringInStr($string, "{")
If $start = 0 Then ExitLoop;no more open braces, so no more special chars
$end = StringInStr($string, "}")
If $end = 0 Then ExitLoop;no more close braces, so no more special chars
;parse inside of braces:
$Chr5[$i] = StringMid($string, $start, $end - $start + 1)
;replace with Chr(5) leaving the rest of the string:
$string = StringMid($string, 1, $start - 1) & Chr(5) & _
StringMid($string, $end + 1, StringLen($string))
Next
;take out any "!", "^", or "+" characters
;add them to the $Modifiers array to be used durring key sending
Local $Modifiers[StringLen($string) + 1]
For $i = 1 To StringLen($string)
$char = StringMid($string, $i, 1)
$and = 0
If $char = "+" Then
$and = 1
ElseIf $char = "^" Then
$and = 2
ElseIf $char = "!" Then
$and = 4
ElseIf $char = "" Then
ExitLoop
EndIf
If $and <> 0 Then
$Modifiers[$i] = BitOR($Modifiers[$i], $and)
$string = StringMid($string, 1, $i - 1) & _
StringMid($string, $i + 1, StringLen($string))
$i = $i - 1
EndIf
Next
Else;it is raw mode, so set up an all-0 modifier array
Local $Modifiers[StringLen($string) + 1]
EndIf
;now send the chars
$Chr5Index = 1
For $i = 1 To StringLen($string)
$char = StringMid($string, $i, 1)
If $char = Chr(5) Then
$char = $Chr5[$Chr5Index]
$Chr5Index = $Chr5Index + 1
EndIf
$isUpper = 0
For $j = 1 To UBound($upper) - 1
If $char == $upper[$j] Then $isUpper = 1
Next
;1 SHIFT, 2 CTRL, 4 ALT (programmer note to keep the bits straight)
If $isUpper = 1 OR BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTDOWN}")
If BitAND($Modifiers[$i], 4) = 4 AND NOT $alt Then $char = "!" & $char
If BitAND($Modifiers[$i], 2) = 2 AND NOT $ctrl Then $char = "^" & $char
If BitAND($Modifiers[$i], 4) = 4 AND $alt Then Send("{ALTDOWN}")
If BitAND($Modifiers[$i], 2) = 2 AND $ctrl Then Send("{CTRLDOWN}")
$ret = ControlSend($title, $text, $className, $char, $flag)
If BitAND($Modifiers[$i], 4) = 4 AND $alt Then Send("{ALTUP}")
If BitAND($Modifiers[$i], 2) = 2 AND $ctrl Then Send("{CTRLUP}")
If $isUpper = 1 OR BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTUP}")
If NOT $ret Then return 0;window or control not found
Next
return 1
EndFunc