Advertisement
Guest User

Untitled

a guest
Aug 30th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. #SingleInstance Force
  2. #Requires AutoHotkey v2.0
  3.  
  4. *F1::
  5. {
  6. Reload ; this script. doesnt work during a loop T_T if you try it will duplicate the application and you'll have to close like 100 of them
  7. }
  8.  
  9. ^0::
  10. {
  11.  
  12. ; this section sets up our toolbar and only clicks if it can find stock option pricing relevant to A-E
  13. if ImageSearch(&FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\a.png")
  14. {
  15. Click FoundX, FoundY
  16. }
  17.  
  18. Sleep 300
  19. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\b.png"
  20. Click FoundX, FoundY
  21. RandSleep := Random(300, 500)
  22. Sleep RandSleep
  23.  
  24. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*30 C:\Users\Matthew3\Desktop\images\c.png"
  25. Click FoundX, FoundY
  26. RandSleep := Random(300, 400)
  27. Sleep RandSleep
  28.  
  29. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*100 C:\Users\Matthew3\Desktop\images\d.png"
  30. Click FoundX, FoundY
  31. Sleep 300
  32.  
  33. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*150 C:\Users\Matthew3\Desktop\images\e.png"
  34. Click FoundX, FoundY
  35. sleep 1000
  36.  
  37. Send "1"
  38.  
  39. sleep 500
  40.  
  41. ; this section confirms cubes if they are the right dark shade
  42.  
  43.  
  44. if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5)
  45. {
  46. cube1 := 1
  47. }
  48.  
  49. if PixelSearch(&OutputVarX, &OutputVarY, 1214, 725, 1224, 735, 0x5f5b4e, 5)
  50. {
  51. cube2 := 1
  52. }
  53.  
  54. if PixelSearch(&OutputVarX, &OutputVarY, 1166, 763, 1176, 773, 0x5f5b4e, 5)
  55. {
  56. cube3 := 1
  57. }
  58.  
  59. if PixelSearch(&OutputVarX, &OutputVarY, 1116, 723, 1126, 733, 0x5f5b4e, 5)
  60. {
  61. cube4 := 1
  62. }
  63.  
  64. if PixelSearch(&OutputVarX, &OutputVarY, 1111, 694, 1121, 704, 0x5f5b4e, 5)
  65. {
  66. cube5 := 1
  67. }
  68.  
  69. if PixelSearch(&OutputVarX, &OutputVarY, 1218, 684, 1228, 694, 0x5f5b4e, 5)
  70. {
  71. cube6 := 1
  72. }
  73.  
  74. if PixelSearch(&OutputVarX, &OutputVarY, 1218, 759, 1228, 769, 0x5f5b4e, 5)
  75. {
  76. cube7 := 1
  77. }
  78.  
  79. ; this section searches for cube1 again, and this time, if not found, it will go to shader() which will manually recolour the cube dark enough. if shader cant do it, it will go to shader2() which resets our browser, and loops back to first: to try all over again
  80.  
  81. first:
  82. if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5)
  83. {
  84. ; no need for code, its already the right shade, so just move on
  85. }
  86. shader() ; function to update shade. if there arent enough units to update shade, it'll refresh browser and restart from first.
  87. }
  88.  
  89.  
  90. ; once i resolve this i need to duplicate first for every cube. and expand amount of cubes.
  91.  
  92.  
  93.  
  94. shader()
  95. {
  96. if PixelSearch(&OutputVarX, &OutputVarY, 1168, 684, 1173, 694, 0x5f5b4e, 5) ; repeat search for cube1. so that i can use OutputVarX and OutputVarY (wont work if only in the main script)
  97. {
  98. Click OutputVarX, OutputVarY ; click cube1
  99. sleep 200
  100. Click (OutputVarX - 25), (OutputVarY - 15) ; click symbol
  101. sleep 300
  102. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*100 C:\Users\Matthew3\Desktop\images\units.png" ; click send all units
  103. Click (FoundX + 470), (FoundY + 28)
  104. sleep 200
  105. A_Clipboard := ""
  106. Click (FoundX + 50), (FoundY + 28) ; work out how many units we have, copy to clipboard for use in a variable. so double click.
  107. Click (FoundX + 50), (FoundY + 28)
  108. sleep 200
  109. Send "^c"
  110. ClipWait(1) ; idk how this works exactly but it wont work without this, google later
  111.  
  112. try
  113. {
  114. Unitcount := A_Clipboard
  115. }
  116.  
  117. if unitcount = ""
  118. {
  119. unitcount := 0
  120. }
  121.  
  122.  
  123. if unitcount >= 9 ; if we have enough units, so search for the confirm button, click that, then click the duration button and copy to clipboard. should hopefully update shade, and we have the duration saved for later use maybe.
  124. {
  125. ImageSearch &FoundX, &FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, "*50 C:\Users\Matthew3\Desktop\images\confirm.png"
  126. Click FoundX, FoundY
  127. sleep 200
  128.  
  129. A_Clipboard := ""
  130.  
  131. ImageSearch &FoundX, &FoundY, 776, 445, 1200, 789, "*120 C:\Users\Matthew3\Desktop\images\duration.png"
  132. Click (FoundX + 100), FoundY
  133. Click (FoundX + 100), FoundY
  134. Click (FoundX + 100), FoundY
  135. Send "^c"
  136. }
  137. else ; not enough units, just reset browser with F5 and start over again
  138. {
  139. shader2() ; after it runs shader2, it'll come back here, and then go to first:
  140. goto first
  141. }
  142. }
  143.  
  144.  
  145. }
  146.  
  147. shader2()
  148. {
  149. Send "{F5}" ; not enough units, just reset browser and try everything all over again. next time, it might be the right colour, or at least the right amount of units.
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement