#RequireAdmin #include "lib.au3" #Include #include #include Opt("SendKeyDelay", 35) Opt("SendKeyDownDelay", 120) HotKeySet("^p", "screen") HotKeySet("$", "toggle") Global $flag = False Global $resetCounter = 0 ;detecPos($winName) Global $startx Global $starty Global $endx Global $endy Global $winName = "" While 1 Sleep(50) If $flag Then $time = _Timer_Init() If Not WinActive($winName) Then WinActivate($winName) Sleep(4000) EndIf detecPos($winName) If PixelGetColor($startx+24, $starty+565) == 0x182951 And PixelGetColor($startx+24, $starty+564) == 0x2A54A4 Then ; in menu tip("In Char selection menu") $flag = False tip("stop") ElseIf PixelGetColor($startx+342, $starty+489) == 0x5D5012 And PixelGetColor($startx+342, $starty+490) == 0x403512 Then ; Meditate Send("&") $str = @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" pressed 1 "&_Timer_Diff($time)&" ms"&Chr(10) addData("log.txt", $str); ConsoleWrite($str); tip("1") Sleep(10000) EndIf EndIf WEnd ;While PixelGetColor($startx + 140, $starty + 110) <> 0x2D6EB9 ;Menu de fin ; Sleep(100) ;WEnd Func screen() detecPos($winName) $unixtimestamp = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) initdir("ScreenDump") _ScreenCapture_Capture("ScreenDump\"&$unixtimestamp&".png", $startx, $starty, $endx-1, $endy-1, False) EndFunc Func detecPos($title) $tab = WinGetPos($title) ;_ArrayDisplay($tab) $myx = $tab[0] $myy = $tab[1] $winWidth = $tab[2] $winHeight = $tab[3] $tab = WinGetClientSize($title) ;_ArrayDisplay($tab) $borders = $winWidth - $tab[0] $border = $borders / 2 $borderTop = $winHeight - ($tab[1] + $border) ;ConsoleWrite("$borders "&$borders&Chr(10)) ;ConsoleWrite("$border "&$border&Chr(10)) ;ConsoleWrite("$borderTop "&$borderTop&Chr(10)) $startx = $myx + $border $starty = $myy + $borderTop $endx = $myx + $border + $tab[0] $endy = $myy + $borderTop + $tab[1] EndFunc Func toggle() If $flag Then $flag = False tip("stop") Else detecPos($winName) $flag = True tip("start") EndIf EndFunc