Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.65 KB | None | 0 0
  1. /*
  2. © 2017 Commanding
  3. Free to use/distribute/change, but please give credit to the original!
  4. */
  5. #SingleInstance, force
  6. Menu, Tray, NoStandard
  7. Menu, Tray, Add, Exit, Exit
  8. Menu, Tray, Default, Exit
  9.  
  10. if not A_IsAdmin ; Checks if script is being run as an administrator, if not it wil prompt for it.
  11. {
  12. Run *RunAs "%A_ScriptFullPath%"
  13. ExitApp
  14. }
  15. diam = 25 ; Maximum canvas size of X-Y values for crosshair
  16.  
  17. Max = 255 ; Used to set max color value for slider
  18. a1=BE ; Red value
  19. a2=00 ; Green value
  20. a3=FF ; Blue value
  21.  
  22. crosshair1 = 10-0 10-4 9-5 8-5 7-5 6-7 5-8 5-10 0-9 0-15 5-14 5-16 6-17 7-18 8-19 9-19 10-20 9-25 15-25 14-19 15-19 16-19 17-18 18-17 19-16 19-15 20-14 25-15 25-9 20-10 19-9 19-8 18-7 17-5 16-5 14-5 15-0 10-0 12-9 10-4 9-5 8-5 7-5 6-7 5-8 5-10 9-12 5-14 5-16 6-17 7-18 8-19 9-19 10-20 12-15 14-19 15-19 16-19 17-18 18-17 19-16 19-15 20-14 16-12 20-10 19-9 19-8 18-7 17-5 16-5 14-5 12-9 12-11 13-12 12-13 12-12 12-11 12-9 10-0
  23. crosshair2 = 10-10 7-2 12-2 12-13 13-12 12-11 12-2 18-2 14-10 23-5 23-18 14-14 18-23 7-23 10-14 2-18 2-5 10-10 6-2 5-2 3-3 2-5 2-5 2-18 2-19 3-21 5-23 6-23 18-23 19-23 21-22 23-19 23-18 23-5 23-5 22-3 20-2 19-2 6-2
  24. crosshair3 = 11-16 11-22 9-20 8-19 7-18 6-17 5-16 5-15 4-14 4-10 5-9 5-8 6-7 7-6 8-5 9-4 10-4 11-3 14-3 15-4 16-4 17-5 18-6 19-7 20-8 20-9 21-10 21-14 20-15 20-16 19-17 18-18 17-19 16-20 14-22 14-16 15-17 16-17 17-16 17-15 18-14 18-10 17-9 17-8 16-7 15-7 14-6 11-6 10-7 9-7 8-8 8-9 7-10 7-14 8-15 8-16 9-17 10-17 11-16 11-16 11-12 12-13 12-10 13-11 12-12 12-13 11-12 12-13 11-14 13-14 13-12 14-13 13-14 11-14
  25. crosshair4 = 7-8 12-0 17-8 20-12 24-21 15-21 9-21 0-21 4-12 6-13 3-19 9-19 9-21 15-21 15-19 21-19 18-13 20-12 17-8 15-9 12-4 9-9 7-8
  26. crosshair5 = 12-0 15-0 16-1 17-1 18-2 19-2 20-3 21-4 22-5 22-6 23-7 23-8 24-9 24-15 23-16 23-17 22-18 22-19 21-20 20-21 19-22 18-22 17-23 16-23 15-24 9-24 8-23 7-23 6-22 5-22 4-21 3-20 2-19 2-18 1-17 1-16 0-15 0-9 1-8 1-7 2-6 2-5 3-4 4-3 5-2 6-2 7-1 8-1 9-0 12-0 13-1 13-9 12-9 12-2 9-2 8-3 7-3 6-4 5-4 4-5 4-6 3-7 3-8 2-9 2-12 9-12 9-13 2-13 2-15 3-16 3-17 4-18 4-19 5-20 6-20 7-21 8-21 9-22 12-22 12-15 13-15 13-22 15-22 16-21 17-21 18-20 19-20 20-19 20-18 21-17 21-16 22-15 22-13 15-13 15-12 22-12 22-9 21-8 21-7 20-6 20-5 19-4 18-4 17-3 16-3 15-2 12-2 12-0
  27. crosshair6 = 12-0 15-0 16-1 17-1 18-2 19-2 20-3 21-4 22-5 22-6 23-7 23-8 24-9 24-15 23-16 23-17 22-18 22-19 21-20 20-21 19-22 18-22 17-23 16-23 15-24 9-24 8-23 7-23 6-22 5-22 4-21 3-20 2-19 2-18 1-17 1-16 0-15 0-9 1-8 1-7 2-6 2-5 3-4 4-3 5-2 6-2 7-1 8-1 9-0 12-0 12-2 9-2 8-3 7-3 6-4 4-3 3-4 4-6 3-7 3-8 2-9 2-15 3-16 3-17 4-18 2-19 4-22 6-20 7-21 8-21 9-22 15-22 16-21 17-21 18-20 20-21 21-19 20-18 21-17 21-16 22-15 22-9 21-8 21-7 20-6 21-4 20-3 18-4 17-3 16-3 15-2 12-2 12-0 12-13 13-12 12-11 12-0
  28. crosshair7 = 12-0 15-0 16-1 17-1 18-2 19-2 20-3 21-4 22-5 22-6 23-7 23-8 24-9 24-15 23-16 23-17 22-18 22-19 21-20 20-21 19-22 18-22 17-23 16-23 15-24 9-24 8-23 7-23 6-22 5-22 4-21 3-20 2-19 2-18 1-17 1-16 0-15 0-9 1-8 1-7 2-6 2-5 3-4 4-3 5-2 6-2 7-1 8-1 9-0 12-0 12-2 9-2 8-3 8-6 7-7 7-10 8-10 9-9 9-7 8-6 8-3 7-3 6-4 5-4 4-5 4-6 3-7 3-8 2-9 2-15 3-16 3-17 4-18 4-19 5-20 6-20 7-21 8-21 9-22 12-22 12-16 9-16 8-17 7-17 5-19 4-18 4-17 5-16 6-15 7-14 8-14 9-13 15-13 16-14 17-14 18-15 19-16 20-17 20-18 19-19 18-19 17-17 16-17 15-16 12-16 12-22 15-22 16-21 17-21 18-20 19-20 20-19 20-18 21-17 21-16 22-15 22-9 21-8 21-7 20-6 20-5 19-4 18-4 17-3 16-3 16-7 16-10 17-10 18-9 18-7 17-6 16-7 16-3 15-2 12-2 12-0
  29. crosshair8 = 12-0 15-0 16-1 17-1 18-2 19-2 20-3 21-4 22-5 22-6 23-7 23-8 24-9 24-15 23-16 23-17 22-18 22-19 21-20 20-21 19-22 18-22 17-23 16-23 15-24 9-24 8-23 7-23 6-22 5-22 4-21 3-20 2-19 2-18 1-17 1-16 0-15 0-9 1-8 1-7 2-6 2-5 3-4 4-3 5-2 6-2 7-1 8-1 9-0 12-0 12-2 9-2 8-3 7-3 6-4 5-4 4-5 4-6 3-7 3-8 2-9 2-15 3-16 3-17 4-18 4-19 5-20 6-20 7-21 8-21 8-20 8-16 4-16 4-17 7-20 8-20 8-21 9-22 15-22 16-21 16-20 16-16 18-16 20-16 20-17 16-20 16-21 17-21 18-20 19-20 20-19 20-18 21-17 21-16 22-15 22-9 21-8 21-7 20-6 20-5 19-4 18-4 17-3 16-3 15-3 9-3 12-6 15-3 15-2 12-2 12-0
  30. crosshair9 = 12-0 25-0 25-25 0-25 0-0 9-0 7-2 2-2 2-7 0-9 0-15 2-17 2-23 7-23 9-25 16-25 18-23 23-23 23-17 25-15 25-9 23-7 23-2 17-2 15-0 12-0 12-3 12-11 11-11 11-12 3-12 3-13 11-13 11-14 12-14 12-22 13-22 13-14 14-14 14-13 22-13 22-12 14-12 14-11 13-11 13-3 12-3 12-0
  31. crosshair10 = 11-11 14-11 14-14 11-14 11-11
  32. ; These are X-Y pairs, used to draw the window in the desired shape.
  33. activecrosshair := crosshair1 ; Default crosshair
  34.  
  35. invisible = 0
  36. menutoggle = 1 ; Initialize menu to OFF
  37. previewactive1 = 1 ; Default cursor is selected in F10 Menu
  38. previewactive2 = 0 ; Following selections are 'inactive'
  39. previewactive3 = 0
  40. previewactive4 = 0
  41. previewactive5 = 0
  42. previewactive6 = 0
  43. previewactive7 = 0
  44. previewactive8 = 0
  45. previewactive9 = 0
  46. previewactive10 = 0
  47. start: ; Gosubs here after icon selection
  48. Gui, crosshair:New, +LastFound +AlwaysOnTop -Caption ; Instantiate GUI window with name 'crosshair', set as Active window, set to be always-on-top, and remove the window borders.
  49. Gui, crosshair:+Owner ; Makes the GUI owned by the script's main window, forcing non-display of a taskbar button
  50. Gui margin,0,0 ; Sets the window margin to 0,0 to disable padding
  51. Gui crosshair:Add,Progress,x-2 y-2 w35 h35 c%a1%%a2%%a3% -border vCrosshair,100 ; Creates a silder with the hex color value of a1+a2+a3(RGB), and removes the slider's default border
  52. SysGet, mon, Monitor ; Get main working monitor's maximum dimensions
  53. Gui crosshair:show, % "x" monRight//2-(diam//2) " y" monBottom//2-(diam//2) NA ; Set crosshair to center in the main monitor
  54. WinSet, Region, %activecrosshair%, A ; Set active crosshair
  55. WinGetPos, Xpos, Ypos, A ; Grab window's Xpos and Ypos to allow everything to adjust dynamically with window position.
  56. menuXpos := Xpos+50 ; Offset F10 Menu from center of main GUI window
  57. menuYpos := Ypos+50 ; Offset F10 Menu from center of main GUI window
  58. Gui, +E0x80020 ; Extended style, makes the window ignore the mouse cursor
  59. return
  60.  
  61. ins::
  62. if invisible = 0
  63. {
  64. invisible = 1
  65. Gui, crosshair:Hide
  66. Gui, colorslider:Destroy
  67. }
  68. Else
  69. {
  70. invisible = 0
  71. Gui, crosshair:Show
  72. }
  73. return
  74.  
  75. home::
  76. if menutoggle = 0
  77. {
  78. menutoggle = 1
  79. Gui, colorslider:Destroy
  80. }
  81. Else
  82. {
  83. menutoggle = 0 ; Just in case
  84.  
  85. crosshairXpos1 := Xpos+100, crosshairXpos6 := Xpos+100
  86. crosshairXpos2 := Xpos+140, crosshairXpos7 := Xpos+140
  87. crosshairXpos3 := Xpos+180, crosshairXpos8 := Xpos+180
  88. crosshairXpos4 := Xpos+220, crosshairXpos9 := Xpos+220
  89. crosshairXpos5 := Xpos+260, crosshairXpos10 := Xpos+260
  90. crosshairYpos1 := Ypos+60, crosshairYpos2 := Ypos+60, crosshairYpos3 := Ypos+60, crosshairYpos4 := Ypos+60, crosshairYpos5 := Ypos+60
  91. crosshairYpos6 := Ypos+100, crosshairYpos7 := Ypos+100, crosshairYpos8 := Ypos+100, crosshairYpos9 := Ypos+100, crosshairYpos10 := Ypos+100
  92.  
  93. Gui, colorslider:New, +AlwaysOnTop +E0x08000000 -Caption +border
  94. Gui -dpiscale
  95. Gui margin,5,5
  96. Gui, colorslider:Show,x%menuXpos% y%menuYpos% w245 h85, Color Slider
  97. Gui, colorslider:Add, Slider, w35 h75 vaa gsave AltSubmit -border Page10 Range1-300 TickInterval50 Vertical,
  98.  
  99. loop, 10
  100. {
  101. boxXpos%A_Index% := crosshairXpos%A_Index%-5
  102. boxYpos%A_Index% := crosshairYpos%A_Index%-5
  103. if previewactive%A_Index% = 1
  104. {
  105. SelectionColor%A_Index% = Silver
  106. PreviewColor%A_Index% = Fuchsia
  107. }
  108. else
  109. {
  110. SelectionColor%A_Index% = Gray
  111. PreviewColor%A_Index% = Blue
  112. }
  113.  
  114. selectionColorLoopX := % boxXpos%A_Index%
  115. selectionColorLoopY := % boxYpos%A_Index%
  116. crosshairColorLoopX := % crosshairXpos%A_Index%
  117. crosshairColorLoopY := % crosshairYpos%A_Index%
  118. shadowboxColor := % selectioncolor%A_Index%
  119. crosshairColor := % previewcolor%A_Index%
  120. crosshairNumber := % crosshair%A_Index%
  121. selectionNumber = Selection%A_Index% ;
  122.  
  123. Gui, shadowbox%A_Index%:New, +AlwaysOnTop +E0x08000000 -Caption
  124. Gui -dpiscale
  125. Gui margin,0,0
  126. Gui shadowbox%A_Index%:Add,Listview, w35 h35 Background%shadowboxColor% v%A_Index% gSelection -Hdr -E0x200 -border AltSubmit
  127. Gui, shadowbox%A_Index%:+Ownercolorslider
  128. Gui, shadowbox%A_Index%:Show,x%selectionColorLoopX% y%selectionColorLoopY% w35 h35
  129.  
  130. Gui, crosshairpreview%A_Index%:New, +AlwaysOnTop +E0x08000000 -Caption
  131. Gui crosshairpreview%A_Index%:Add,Progress, x-3 y-3 w35 h35 c%crosshairColor% vPreview%A_Index% -border,100
  132. Gui, crosshairpreview%A_Index%:+Ownercolorslider
  133. Gui, crosshairpreview%A_Index%:Show,x%crosshairColorLoopX% y%crosshairColorLoopY% w35 h35
  134. WinSet, Region, %crosshairNumber%, A
  135. Gui, +E0x80020
  136. Gosub save
  137. }
  138. return
  139. }
  140.  
  141.  
  142. Selection:
  143. selectionCrosshairXpos := % crosshairXpos%A_GuiControl%
  144. selectionCrosshairYpos := % crosshairYpos%A_GuiControl%
  145. crosshairActiveNum := % crosshair%A_GuiControl%
  146. if A_GuiEvent = Normal
  147. {
  148. loop, 10
  149. {
  150. if A_Index = %A_GuiControl%
  151. {
  152. previewactive%A_GuiControl% = 1
  153. Gui, crosshairpreview%A_GuiControl%:New, +AlwaysOnTop +E0x08000000 -Caption
  154. Gui crosshairpreview%A_GuiControl%:Add,Progress,x-2 y-2 w35 h35 cFuchsia vPreview%A_GuiControl% -border,100
  155. Gui, crosshairpreview%A_GuiControl%:+Ownercolorslider
  156. Gui, crosshairpreview%A_GuiControl%:Show,x%selectionCrosshairXpos% y%selectionCrosshairYpos% w35 h35
  157. WinSet, Region, %crosshairActiveNum%, A
  158. Gui, +E0x80020
  159. activecrosshair := crosshairActiveNum
  160. Gui, crosshair:Destroy
  161. GuiControl shadowbox%A_GuiControl%:+BackgroundSilver, %A_GuiControl%
  162. GuiControl crosshairpreview%A_GuiControl%:+cFuchsia, Preview%A_GuiControl%
  163. gosub, Start
  164. }
  165. else
  166. {
  167. previewactive%A_Index% = 0
  168. GuiControl shadowbox%A_Index%:+BackgroundGray, %A_Index%
  169. GuiControl crosshairpreview%A_Index%:+cBlue, Preview%A_Index%
  170. }
  171. }
  172. }
  173. return
  174.  
  175.  
  176. save:
  177. Gui, crosshair:Submit, Nohide
  178. n := Round(max/50,0)
  179. if aa between 1 and 50
  180. {
  181. a1 := Color(max)
  182. ab := aa*n
  183. a2 := Color(ab)
  184. a3 := Color(0)
  185. }
  186. if aa between 51 and 100
  187. {
  188. a2 := Color(max)
  189. ab := (max-aa)*n
  190. a1 := Color(ab)
  191. a3 := Color(0)
  192. }
  193. if aa between 101 and 150
  194. {
  195. a2 := Color(max)
  196. ab := (aa-100)*n
  197. a3 := Color(ab)
  198. a1 := Color(0)
  199. }
  200. if aa between 151 and 200
  201. {
  202. a3 := Color(max)
  203. ab := (max-(aa-150))*n
  204. a2 := Color(ab)
  205. a1 := Color(0)
  206. }
  207. if aa between 201 and 250
  208. {
  209. a3 := Color(max)
  210. ab := (aa-200)*n
  211. a1 := Color(ab)
  212. a2 := Color(0)
  213. }
  214. if aa between 251 and 300
  215. {
  216. a1 := Color(max)
  217. ab := (max-(aa-250))*n
  218. a3 := Color(ab)
  219. a2 := Color(0)
  220. }
  221. loop, 1
  222. {
  223. GuiControl crosshair:+c%a1%%a2%%a3%, Crosshair
  224. }
  225. return
  226.  
  227. Color(N) {
  228. SetFormat, Integer, Hex
  229. N += 0
  230. SetFormat, Integer, D
  231. StringTrimLeft, N, N, 2
  232. If(StrLen(N) < 2)
  233. N = 0%N%
  234. Return N
  235. }
  236.  
  237. Exit:
  238. ExitApp
  239. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement