Advertisement
Guest User

Untitled

a guest
Jan 30th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.86 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <GUIListBox.au3>
  5. #include <StaticConstants.au3>
  6. #include <WindowsConstants.au3>
  7. #include <MsgBoxConstants.au3>
  8. #include <Timers.au3>
  9. #include <Misc.au3>
  10. #Region ### START Koda GUI section ### Form=
  11. $Form1_1 = GUICreate("Markoz Tool", 336, 383, 190, 122)
  12. $Checkbox1 = GUICtrlCreateCheckbox("Turn on/off", 8, 336, 89, 25)
  13. $List1 = GUICtrlCreateList("", 8, 32, 121, 123)
  14. GUICtrlSetData(-1, "")
  15. $Label1 = GUICtrlCreateLabel("Process List:", 8, 8, 64, 17)
  16. $Label2 = GUICtrlCreateLabel("Your mouse positions:", 168, 16, 107, 17)
  17. $XPo = GUICtrlCreateLabel("", 16, 224, 4, 4)
  18. $YPos = GUICtrlCreateLabel("00", 240, 80, 48, 17)
  19. $XPos = GUICtrlCreateLabel("00", 168, 80, 48, 17)
  20. $Label3 = GUICtrlCreateLabel("Key of your amulet:", 16, 176, 94, 17)
  21. $amuletKeyInput = GUICtrlCreateInput("{F1}", 16, 208, 81, 21)
  22. $Label4 = GUICtrlCreateLabel("Mouse position to scan:", 160, 112, 116, 17)
  23. $XAmuletPos = GUICtrlCreateInput("00", 160, 176, 41, 21)
  24. $YAmuletPos = GUICtrlCreateInput("00", 224, 176, 49, 21)
  25. $X = GUICtrlCreateLabel("X", 168, 48, 27, 17)
  26. $Y = GUICtrlCreateLabel("Y", 232, 48, 11, 17)
  27. $ScanX = GUICtrlCreateLabel("ScanX", 160, 144, 36, 17)
  28. $ScanY = GUICtrlCreateLabel("ScanY", 224, 144, 36, 17)
  29. $Button1 = GUICtrlCreateButton("Take Pixel Without Amulet", 120, 288, 137, 25)
  30. $AmuletColorID = GUICtrlCreateLabel("ID of a color", 264, 296, 62, 17)
  31. $Label5 = GUICtrlCreateLabel("Key delay", 144, 344, 82, 17)
  32. $delay = GUICtrlCreateInput("200", 240, 344, 81, 21)
  33. $Label6 = GUICtrlCreateLabel("Amulet", 280, 176, 44, 25)
  34. $XRingPos = GUICtrlCreateInput("00", 160, 216, 41, 21)
  35. $YRingPos = GUICtrlCreateInput("00", 224, 216, 49, 21)
  36. $Label7 = GUICtrlCreateLabel("Ring", 280, 216, 34, 17)
  37. $RingColorID = GUICtrlCreateLabel("ID of a color", 264, 256, 62, 17)
  38. $Button2 = GUICtrlCreateButton("Take a Pixel Without Ring", 120, 248, 137, 25)
  39. $Label8 = GUICtrlCreateLabel("Key of your ring:", 16, 248, 88, 17)
  40. $ringKeyInput = GUICtrlCreateInput("{F2}", 16, 280, 73, 21)
  41. GUISetState(@SW_SHOW)
  42. #EndRegion ### END Koda GUI section ###
  43. DllOpen("user32.dll")
  44. global $procID = 0
  45. global $on = false
  46. global $hDLL = DllOpen("user32.dll")
  47.  
  48. While 1
  49.     $nMsg = GUIGetMsg()
  50.  
  51.  
  52.     Switch $nMsg
  53.         Case $GUI_EVENT_CLOSE
  54.             DllClose($hDLL)
  55.             GUIDelete()
  56.             Exit
  57.         Case $Button1:
  58.             GetPixelColorAmulet()
  59.         Case $Button2:
  60.             GetPixelColorRing()
  61.         Case $Checkbox1:
  62.              $on = not $on
  63.     EndSwitch
  64.     hideShow()
  65.     mouse()
  66.     procList()
  67.     if $on  and $procID > 0 then
  68.         MainFunc()
  69.     EndIf
  70. WEnd
  71.  
  72. Func mouse()
  73. local $m =  MouseGetPos()
  74. if GUICtrlRead($Xpos) <> $m[0] or GUICtrlRead($Ypos) <> $m[1] then
  75.     GUICtrlSetData($XPos,$m[0])
  76.     GUICtrlSetData($YPos,$m[1])
  77. EndIf
  78. EndFunc
  79.  
  80. Func hideShow()
  81. $windowName = "Markoz Tool"
  82.  If _IsPressed("2E", $hDLL) Then
  83.     WinSetState($windowName, "", @SW_SHOW)
  84. ElseIf _IsPressed("23", $hDLL) Then
  85.     WinSetState($windowName, "", @SW_HIDE)
  86. EndIf
  87. EndFunc
  88.  
  89.  
  90. Func GetPixelColorAmulet()
  91. $handle = _GetHwndFromPID($procID)
  92. $xAmulet = GUICtrlRead($XAmuletPos)
  93. $yAmulet = GUICtrlRead($YAmuletPos)
  94. $valueAmulet = PixelGetColor($xAmulet, $yAmulet,$handle)
  95. GUICtrlSetData($AmuletColorID,$valueAmulet)
  96. EndFunc
  97.  
  98. Func GetPixelColorRing()
  99. $handle = _GetHwndFromPID($procID)
  100. $xRing = GUICtrlRead($xRingPos)
  101. $yRing = GUICtrlRead($YRingPos)
  102. $valueRing = PixelGetColor($xRing, $yRing,$handle)
  103. GUICtrlSetData($RingColorID,$valueRing)
  104. EndFunc
  105.  
  106. Func procList()
  107. local $process = "client.exe"
  108. local $aProcessList = ProcessList($process)
  109. For $i = 1 To $aProcessList[0][0]
  110. $procID = $aProcessList[$i][1]
  111. GUICtrlSetData($List1,$aProcessList[$i][0] & "   " & $aProcessList[$i][1])
  112. Next
  113. If ProcessExists($process) == 0 then
  114.     GUICtrlSetData($List1,"")
  115. EndIf
  116. EndFunc
  117.  
  118.  
  119. Func MainFunc()
  120.     local $handle = _GetHwndFromPID($procID)
  121.     $delaySleep = GUICtrlRead($delay)
  122.     $keyAmulet = GUICtrlRead($amuletKeyInput)
  123.     $keyRing = GUICtrlRead($ringKeyInput)
  124.     $colorNowAmulet = PixelGetColor(GUICtrlRead($XAmuletPos),GUICtrlRead($YAmuletPos),$handle)
  125.     $colorNowRing = PixelGetColor(GUICtrlRead($XRingPos),GUICtrlRead($YRingPos),$handle)
  126.     $colorNoAmulet = GUICtrlRead($AmuletColorID)
  127.     $colorNoRing = GUICtrlRead($RingColorID)
  128.     If $colorNowRing == $colorNoRing then
  129.         ControlSend($handle,"","",$keyRing)
  130.         Sleep($delaySleep)
  131.     EndIf
  132.     If $colorNowAmulet == $colorNoAmulet then
  133.         ControlSend($handle,"","",$keyAmulet)
  134.         Sleep($delaySleep)
  135.     EndIf
  136. EndFunc
  137.  
  138.  
  139. Func _GetHwndFromPID($PID)
  140.     $hWnd = 0
  141.     $winlist = WinList()
  142.     Do
  143.         For $i = 1 To $winlist[0][0]
  144.             If $winlist[$i][0] <> "" Then
  145.                 $iPID2 = WinGetProcess($winlist[$i][1])
  146.                 If $iPID2 = $PID Then
  147.                     $hWnd = $winlist[$i][1]
  148.                     ExitLoop
  149.                 EndIf
  150.             EndIf
  151.         Next
  152.     Until $hWnd <> 0
  153.     Return $hWnd
  154. EndFunc  ;==>_GetHwndFromPID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement