Sleep, 10000
WinWait, Company Of Heroes 2,
IfWinNotActive, Company Of Heroes 2, , WinActivate, Company Of Heroes 2,
WinWaitActive, Company Of Heroes 2,
WinGetPos, xborder, yborder,width,height,Company Of Heroes 2
xedge:= (width-1024)/2
ytitlebaredge:= height-768-xedge
Loop, 100
{
;Start Loading
xcord:=xedge+516
ycord:=ytitlebaredge+620
Click %xcord% %ycord%
Sleep, 5000
;Start Match
xcord:=xedge+514
ycord:=ytitlebaredge+652
MouseMove, %xcord%, %ycord%
xcordl:=xedge+453
ycordl:=ytitlebaredge+643
xcordu:=xedge+455
ycordu:=ytitlebaredge+645
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x1A227F , 5
while (ErrorLevel = 1)
{
Sleep, 100
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x1A227F , 5
}
xcord:=xedge+514
ycord:=ytitlebaredge+652
Click %xcord% %ycord%
Sleep, 5000
xcord:=xedge+926
ycord:=ytitlebaredge+443
PixelGetColor, color, %xcord%, %ycord%
Blue:="0x" SubStr(color,3,2)
Blue:=Blue+0
Green:="0x" SubStr(color,5,2)
Green:=Green+0
Red:="0x" SubStr(color,7,2)
Red:=Red+0
while (green <> 0 and blue <> 255)
{
Sleep, 5000
PixelGetColor, color, %xcord%, %ycord%
Blue:="0x" SubStr(color,3,2)
Blue:=Blue+0
Green:="0x" SubStr(color,5,2)
Green:=Green+0
Red:="0x" SubStr(color,7,2)
Red:=Red+0
}
waittime:= (Red*60*1000) + 10000
minuten:=waittime/1000/60
Sleep, %waittime%
WinGetPos, xborder, yborder,width,height,Company Of Heroes 2
xedge:= (width-1024)/2
ytitlebaredge:= height-768-xedge
IfWinNotActive, Company Of Heroes 2, , WinActivate, Company Of Heroes 2,
WinWaitActive, Company Of Heroes 2,
;Quit Match
xcord:=xedge+459
ycord:=ytitlebaredge+45
MouseMove, %xcord%, %ycord%
xcordl:=xedge+421
ycordl:=ytitlebaredge+42
xcordu:=xedge+423
ycordu:=ytitlebaredge+44
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x2F3F8C , 5
while (ErrorLevel = 1)
{
Sleep, 100
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x2F3F8C , 5
}
Click %xcord% %ycord%
Sleep, 1000
;Close Match Stats
CloseMatchstats:
counter=0
xcord:=xedge+487
ycord:=ytitlebaredge+603
MouseMove, %xcord%, %ycord%
xcordl:=xedge+444
ycordl:=ytitlebaredge+602
xcordu:=xedge+446
ycordu:=ytitlebaredge+604
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x2A3A85 , 5
while (ErrorLevel = 1 and counter<60000)
{
Sleep, 100
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x2A3A85 , 5
counter = counter+1
}
;check wether this needs to long (disconnect?)
if (counter>=60000)
{
xcordl:=xedge+551
ycordl:=ytitlebaredge+312
xcordu:=xedge+553
ycordu:=ytitlebaredge+314
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x8BB3CB , 5
;check wether disconnected
if (Errorlevel=0)
{
;accept
Sleep, 5000
xcord:=xedge+511
ycord:=ytitlebaredge+404
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord%, %ycord%
Sleep, 5000
;close stats
xcord:=xedge+487
ycord:=ytitlebaredge+603
Click %xcord% %ycord%
Sleep, 5000
;reconnect
Sleep, 5000
xcord:=xedge+463
ycord:=ytitlebaredge+411
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord% %ycord%
Sleep, 15000
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x8BB3CB , 5
;check wether still disconnected
while (Errorlevel=0)
{
;accept
xcord:=xedge+511
ycord:=ytitlebaredge+404
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord% %ycord%
;reconnect
Sleep, 5000
xcord:=xedge+463
ycord:=ytitlebaredge+411
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord% %ycord%
Sleep, 35000
;reconnect again
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord% %ycord%
PixelSearch, , , %xcordl%, %ycordl%, %xcordu%, %ycordu%, 0x8BB3CB , 5
}
Sleep, 5000
;go back to online&skirmish
xcord:=xedge+150
ycord:=ytitlebaredge+298
MouseMove, %xcord%, %ycord%
Sleep, 500
Click %xcord% %ycord%
Sleep, 5000
;go back to custom game
xcord:=xedge+619
ycord:=ytitlebaredge+437
Click %xcord% %ycord%
Sleep, 5000
;get ai enemy
xcord:=xedge+859
ycord:=ytitlebaredge+279
Click %xcord% %ycord%,
Sleep, 5000
Goto, End
}
Goto, CloseMatchstats
}
xcord:=xedge+487
ycord:=ytitlebaredge+603
Click %xcord% %ycord%
Sleep, 5000
End:
}