Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. CoordMode, Mouse, Screen
  3. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  4. #SingleInstance force
  5. #Persistent
  6.  
  7.  
  8. 1::
  9. LetUserSelectRect(x1, y1, x2, y2)
  10. Return
  11.  
  12. 2::
  13. LetUserSelectRect(xx1, yy1, xx2, yy2)
  14. Return
  15.  
  16. 3::
  17. LetUserSelectRect(xxx1, yyy1, xxx2, yyy2)
  18. Return
  19.  
  20. 6:: ExitApp
  21.  
  22. 4::
  23. Impling:
  24. Loop {
  25. CoordMode, Pixel
  26. PixelSearch, FoundX, FoundY, %x1%, %y1%, %x2%, %y2%, 0x772F29, *15, Fast RGB
  27. If (ErrorLevel) = 0 {
  28. MouseClick, Left, %FoundX%, %FoundY%
  29. gosub, Inventory
  30. if (ErrorLevel)
  31. gosub Impling
  32. }
  33. }
  34. Inventory:
  35. Loop {
  36. CoordMode, Pixel
  37. PixelSearch, FoundXX, FoundYY, %xx1%, %yy1%, %xx2%, %yy2%, 0x443C32, *5, Fast RGB
  38. If (ErrorLevel) = 0
  39. gosub, Banker
  40. if (ErrorLevel)
  41. gosub Impling
  42. }
  43. Banker:
  44. Loop {
  45. CoordMode, Pixel
  46. PixelSearch, FoundXXX, FoundYYY, %xxx1%, %yyy1%, %xxx2%, %yyy2%, 0x89807F, *15, Fast RGB
  47. If (ErrorLevel) = 0
  48. MouseClick, Right, %FoundXXX%, %FoundYYY%
  49. gosub, Impling
  50. }
  51.  
  52.  
  53. 5:: Pause
  54. Return
  55.  
  56. LetUserSelectRect(ByRef X1, ByRef Y1, ByRef X2, ByRef Y2)
  57. {
  58. static r := 3
  59. Loop 4 {
  60. Gui, %A_Index%: -Caption +ToolWindow +AlwaysOnTop
  61. Gui, %A_Index%: Color, Red
  62. }
  63. Hotkey, *LButton, lusr_return, On
  64. KeyWait, LButton, D
  65. MouseGetPos, xorigin, yorigin
  66. SetTimer, lusr_update, 10
  67. KeyWait, LButton
  68. Hotkey, *LButton, Off
  69. SetTimer, lusr_update, Off
  70. Loop 4
  71. Gui, %A_Index%: Destroy
  72. return
  73.  
  74. lusr_update:
  75. MouseGetPos, x, y
  76. if (x = xlast && y = ylast)
  77. ;
  78. return
  79. if (x < xorigin)
  80. x1 := x, x2 := xorigin
  81. else x2 := x, x1 := xorigin
  82. if (y < yorigin)
  83. y1 := y, y2 := yorigin
  84. else y2 := y, y1 := yorigin
  85. ;
  86. Gui, 1:Show, % "NA X" x1 " Y" y1 " W" x2-x1 " H" r
  87. Gui, 2:Show, % "NA X" x1 " Y" y2-r " W" x2-x1 " H" r
  88. Gui, 3:Show, % "NA X" x1 " Y" y1 " W" r " H" y2-y1
  89. Gui, 4:Show, % "NA X" x2-r " Y" y1 " W" r " H" y2-y1
  90. lusr_return:
  91. return
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement