Advertisement
sinkir

bnsPxAu3

Jul 15th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. #RequireAdmin
  2. #include "lib.au3"
  3. #Include <Date.au3>
  4. #include <ScreenCapture.au3>
  5. #include <Timers.au3>
  6. Opt("SendKeyDelay", 35)
  7. Opt("SendKeyDownDelay", 120)
  8.  
  9. HotKeySet("^p", "screen")
  10. HotKeySet("$", "toggle")
  11. Global $flag = False
  12. Global $resetCounter = 0
  13. ;detecPos($winName)
  14.  
  15. Global $startx
  16. Global $starty
  17. Global $endx
  18. Global $endy
  19. Global $winName = ""
  20.  
  21.  
  22. While 1
  23. Sleep(50)
  24. If $flag Then
  25. $time = _Timer_Init()
  26.  
  27. If Not WinActive($winName) Then
  28. WinActivate($winName)
  29. Sleep(4000)
  30. EndIf
  31.  
  32. detecPos($winName)
  33.  
  34. If PixelGetColor($startx+24, $starty+565) == 0x182951 And PixelGetColor($startx+24, $starty+564) == 0x2A54A4 Then ; in menu
  35. tip("In Char selection menu")
  36. $flag = False
  37. tip("stop")
  38.  
  39. ElseIf PixelGetColor($startx+342, $starty+489) == 0x5D5012 And PixelGetColor($startx+342, $starty+490) == 0x403512 Then ; Meditate
  40. Send("&")
  41.  
  42. $str = @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" pressed 1 "&_Timer_Diff($time)&" ms"&Chr(10)
  43. addData("log.txt", $str);
  44. ConsoleWrite($str);
  45. tip("1")
  46.  
  47. Sleep(10000)
  48. EndIf
  49.  
  50.  
  51. EndIf
  52. WEnd
  53.  
  54.  
  55. ;While PixelGetColor($startx + 140, $starty + 110) <> 0x2D6EB9 ;Menu de fin
  56. ; Sleep(100)
  57. ;WEnd
  58.  
  59.  
  60.  
  61. Func screen()
  62. detecPos($winName)
  63.  
  64. $unixtimestamp = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
  65. initdir("ScreenDump")
  66. _ScreenCapture_Capture("ScreenDump\"&$unixtimestamp&".png", $startx, $starty, $endx-1, $endy-1, False)
  67. EndFunc
  68.  
  69. Func detecPos($title)
  70. $tab = WinGetPos($title)
  71. ;_ArrayDisplay($tab)
  72. $myx = $tab[0]
  73. $myy = $tab[1]
  74. $winWidth = $tab[2]
  75. $winHeight = $tab[3]
  76.  
  77. $tab = WinGetClientSize($title)
  78. ;_ArrayDisplay($tab)
  79. $borders = $winWidth - $tab[0]
  80. $border = $borders / 2
  81. $borderTop = $winHeight - ($tab[1] + $border)
  82.  
  83. ;ConsoleWrite("$borders "&$borders&Chr(10))
  84. ;ConsoleWrite("$border "&$border&Chr(10))
  85. ;ConsoleWrite("$borderTop "&$borderTop&Chr(10))
  86.  
  87. $startx = $myx + $border
  88. $starty = $myy + $borderTop
  89. $endx = $myx + $border + $tab[0]
  90. $endy = $myy + $borderTop + $tab[1]
  91. EndFunc
  92.  
  93.  
  94.  
  95. Func toggle()
  96. If $flag Then
  97. $flag = False
  98. tip("stop")
  99. Else
  100. detecPos($winName)
  101.  
  102. $flag = True
  103. tip("start")
  104. EndIf
  105. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement