Najeebsk

COLOR-PICKER.ahk

Dec 30th, 2021 (edited)
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance, Force
  2. SetBatchLines,-1
  3. #NoEnv
  4. SetWorkingDir,%A_ScriptDir%
  5. gui, +ToolWindow
  6. pButton_StartUp()
  7. global pButton:={}
  8. global Press_active:=0,Hover_On:=0,Active_Button
  9. global Main_Window:={Y: 0 , W: 300 , H: 600 }
  10. Main_Window.X:=(A_ScreenWidth-Main_Window.W)-100
  11. global REDSLIDERVALUE := 0 , GREENSLIDERVALUE := 0 , BLUESLIDERVALUE := 0 , RGBCOLORBLOCK := "000000" , GREYSCALESLIDERVALUE := 0 , GREYSCALECOLORBLOCK := "000000"
  12. global REDTRIGGER , GREENTRIGGER , BLUETRIGGER , GREYSCALETRIGGER , OUTPUTCOLOR
  13. global REDHEXVALUE := "00" , GREENHEXVALUE := "00" , BLUEHEXVALUE := "00" , GREYSCALEHEXVALUE := "00"
  14. global REDDECVALUE := "0" , GREENDECVALUE := "0" , BLUEDECVALUE := "0" , GREYSCALEDECVALUE := GREYSCALESLIDERVALUE
  15. global REDMIN1:=0 , REDMAX1:=255 , REDMIN2:=0 , REDMAX2:=255
  16. global GREENMIN1:=0 , GREENMAX1:=255 , GREENMIN2:=0 , GREENMAX2:=255
  17. global BLUEMIN1:=0 , BLUEMAX1:=255 , BLUEMIN2:=0 , BLUEMAX2:=255
  18. global Saved_Colors_List:= [] , SAVEDCOLOREDIT:="" , ALLOWNEWSAVEDVALUE:=0
  19. IfExist, Color_Picker_v2_Saved_Colors_List.txt
  20. {
  21.     FileRead,svdcol,Color_Picker_v2_Saved_Colors_List.txt
  22.     Loop, Parse, svdcol ,*     
  23.         Saved_Colors_List[A_Index]:=A_LoopField
  24. }
  25. IfNotExist, Color_Picker_v2_Saved_Colors_List.txt
  26. {  
  27.     Loop, 150   {
  28.         Saved_Colors_List[A_Index]:="777777",tempcollist:="777777*"
  29.         FileAppend,%tempcollist%,Color_Picker_v2_Saved_Colors_List.txt
  30.     }
  31. }
  32. Create_Main_Window(),Create_SUB_Window(),CREATE_MIXER_WINDOW(),CREATE_SAVED_WINDOW(),CREATE_RANDOM_WINDOW()
  33. SetTimer,SETPICKERONTOP,400
  34. return
  35. GuiClose:
  36.     ExitApp
  37. GuiContextMenu:
  38.     (Tog:=!Tog)?(Main_Window.H:=40):(Main_Window.H:=600)
  39.     Gui,1:Show,% "h" Main_Window.H " NA"
  40.     return
  41. CREATE_MIXER_WINDOW(){
  42.     Gui, 3: +Parent2 -DPIScale -Caption
  43.     Gui, 3: Color, 333333 , 333333
  44.     DRAW_OUTLINE( 3 , 0 , 0 ,250  , 470 , "444444" , "black" ),DRAW_OUTLINE( 3 , 1 , 1 ,248  , 468 , "333333" , "111111" )
  45.     ADD_COLOR_DISPLAYS(),ADD_RGB_SLIDERS(),ADD_GREYSCALE_SLIDERS(),ADD_MIXER_BUTTONS()
  46.     Gui, 3: Show,x7 y10 w250 h470
  47. }
  48. CREATE_SAVED_WINDOW(){
  49.     global
  50.     Gui, 4: +Parent2 -DPIScale -Caption
  51.     Gui, 4: Color,333333,222222
  52.     x:=25
  53.     Loop, 11    {
  54.         Gui,4:Add,Progress,x%x% y40 w1 h300 BackgroundBlack
  55.         x+=20
  56.     }
  57.     y:=40
  58.     Loop, 16    {
  59.         Gui,4:Add,Progress,x25 y%y% w200 h1 BackgroundBlack
  60.         y+=20
  61.     }  
  62.     y:=41,i:=1
  63.     Loop, 15    {
  64.         x:=26
  65.         Loop, 10    {
  66.             Gui,4:Add,Text,x%x% y%y% w19 h19 BackgroundTrans vGUISavedColorTRIGGER_%i% gChange_Colors
  67.             Gui,4:Add,Progress,% "x" x " y" y " w19 h19 Background" Saved_Colors_List[i] " vGUISavedColor_" i
  68.             i++,x+=20
  69.         }
  70.         y+=20  
  71.     }
  72.     Gui,4:Font,caaaaaa s10 w500,Segoe ui
  73.     Gui,4:add,Edit, x75 y355 w100 h20 Center Uppercase -E0x200 vSAVEDCOLOREDIT gSubmit_4,
  74.     DRAW_OUTLINE( 4 , 74 , 354 ,102  , 22 , "777777" , "666666" )
  75.     pButton.Push(New Progress_Button("4",pButton.Length()+1,"SETADDTOSAVEDLIST",10,390,110,20,"111111","777777","252525","880000","992222","ADD COLOR",1))
  76.     pButton.Push(New Progress_Button("4",pButton.Length()+1,"SETREMOVEFROMSAVEDLIST",130,390,110,20,"111111","777777","252525","880000","992222","REMOVE COLOR",1))
  77.     pButton.Push(New Progress_Button("4",pButton.Length()+1,"CLEARALLSAVEDCOLORS",50,420,150,30,"111111","777777","252525","880000","992222","CLEAR ALL COLORS",7))
  78.     Gui, 4: Show,x7 y10 w250 h470
  79.     Gui, 4: Hide
  80. }
  81. CLEARALLSAVEDCOLORS(){
  82.     stime:=A_TickCount
  83.     While(GETKEYSTATE("LBUTTON")){
  84.         if(A_TickCount-stime>3000){
  85.             Loop 150    {
  86.                 GuiControl,% "4:+Background777777", GUISavedColor_%A_Index%
  87.                 Saved_Colors_List[A_Index]:="777777"
  88.             }
  89.             SAVECOLORLISTTOFILE()
  90.             return         
  91.         }
  92.     }
  93. }
  94. Change_Colors(){
  95.     if(ALLOWNEWSAVEDVALUE=1){
  96.         ALLOWNEWSAVEDVALUE:=0
  97.         StringTrimLeft,tsop,A_GUICONTROL,21
  98.         Saved_Colors_List[tsop]:=SAVEDCOLOREDIT
  99.         GuiControl,% "4:+Background" Saved_Colors_List[tsop], GUISavedColor_%tsop%
  100.         SAVECOLORLISTTOFILE()
  101.     }else if(ALLOWNEWSAVEDVALUE=2){
  102.         ALLOWNEWSAVEDVALUE:=0
  103.         StringTrimLeft,tsop,A_GUICONTROL,21
  104.         Saved_Colors_List[tsop]:="777777"
  105.         GuiControl,% "4:+Background" Saved_Colors_List[tsop], GUISavedColor_%tsop%
  106.         SAVECOLORLISTTOFILE()
  107.     }
  108. }
  109. Submit_4(){
  110.     Gui,4:Submit,NoHide
  111. }
  112. SETREMOVEFROMSAVEDLIST(){
  113.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  114.         RETURN
  115.     ALLOWNEWSAVEDVALUE:=2
  116. }
  117. SETADDTOSAVEDLIST(){
  118.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  119.         RETURN
  120.     ALLOWNEWSAVEDVALUE:=1
  121. }
  122. SAVECOLORLISTTOFILE(){
  123.     FileDelete,Color_Picker_v2_Saved_Colors_List.txt
  124.     Loop, 150   {
  125.         tvtstf:=Saved_Colors_List[A_Index] "*"
  126.         FileAppend,%tvtstf%,Color_Picker_v2_Saved_Colors_List.txt
  127.     }
  128. }
  129. Move_Window(){
  130.     POSTMESSAGE , 0XA1 , 2
  131.     SETTIMER , WATCH_HOVER , OFF
  132.     WHILE( GETKEYSTATE( "LBUTTON" ) )
  133.         SLEEP , 10
  134.     SETTIMER , WATCH_HOVER , ON
  135. }
  136. DRAW_OUTLINE( GUI_NAME , X , Y , W , H , COLOR1 :="BLACK", COLOR2 := "BLACK" , THICKNESS := 1 ) {
  137.     GUI , % GUI_NAME ": ADD" , PROGRESS , % "X" X " Y" Y " W" W " H" THICKNESS " BACKGROUND" COLOR1
  138.     GUI , % GUI_NAME ": ADD" , PROGRESS , % "X" X " Y" Y " W" THICKNESS " H" H " BACKGROUND" COLOR1
  139.     GUI , % GUI_NAME ": ADD" , PROGRESS , % "X" X " Y" Y + H - THICKNESS " W" W " H" THICKNESS " BACKGROUND" COLOR2
  140.     GUI , % GUI_NAME ": ADD" , PROGRESS , % "X" X + W - THICKNESS " Y" Y " W" THICKNESS " H" H " BACKGROUND" COLOR2    
  141. }
  142. DRAW_LINE( GUI_NAME , X , Y , W , H , COLOR ) {
  143.     GUI , % GUI_NAME ": ADD" , PROGRESS , % "X" X " Y" Y " W" W " H" H " BACKGROUND" COLOR
  144. }
  145. ADD_GREYSCALE_SLIDERS(){
  146.     Gui, 3:Font,caaaaaa s10 w600 , Segoe UI
  147.     Gui, 3:Add,Text,x190 y140 w20 h256 vGREYSCALETRIGGER gADJUST_SLIDER
  148.     Gui, 3:Add,Progress,x165 y110 w70 h316 Background111111
  149.     Gui, 3:Add,Edit,x170 y115 w60 h20 Center -E0x200 Disabled vGREYSCALEHEXVALUE ,% GREYSCALEHEXVALUE
  150.     Gui, 3:Add,Progress,x190 y140 w20 h256 Background333333 c888888 Range0-255 Vertical vGREYSCALESLIDERVALUE ,% GREYSCALESLIDERVALUE
  151.     Gui, 3:Add,Edit,x170 y401 w60 h20 Center -E0x200 Disabled vGREYSCALEDECVALUE ,% GREYSCALEDECVALUE
  152. }
  153. ADD_RGB_SLIDERS(){
  154.     Gui, 3:Add,Text,x30 y140 w20 h256 vREDTRIGGER gADJUST_SLIDER
  155.     Gui, 3:Add,Text,x73 y140 w20 h256 vGREENTRIGGER gADJUST_SLIDER
  156.     Gui, 3:Add,Text,x115 y140 w20 h256 vBLUETRIGGER gADJUST_SLIDER
  157.     Gui, 3:Add,Progress,x10 y110 w145 h316 Background111111
  158.     Gui, 3:Font,cffffff s10 w600 , Segoe UI
  159.     Gui, 3:Add,Edit,x25 y115 w30 h20 Center -E0x200 Disabled vREDHEXVALUE ,% REDHEXVALUE
  160.     Gui, 3:Add,Edit,x68 y115 w30 h20 Center -E0x200 Disabled vGREENHEXVALUE ,% GREENHEXVALUE
  161.     Gui, 3:Add,Edit,x110 y115 w30 h20 Center -E0x200 Disabled vBLUEHEXVALUE ,% BLUEHEXVALUE
  162.     Gui, 3:Add,Progress,x30 y140 w20 h256 Background330000 caa2222 Range0-255 Vertical vREDSLIDERVALUE,% REDSLIDERVALUE
  163.     Gui, 3:Add,Progress,x73 y140 w20 h256 Background003300 c22aa22 Range0-255 Vertical vGREENSLIDERVALUE,% GREENSLIDERVALUE
  164.     Gui, 3:Add,Progress,x115 y140 w20 h256 Background000033 c2222aa Range0-255 Vertical vBLUESLIDERVALUE,% BLUESLIDERVALUE
  165.     Gui, 3:Add,Edit,x25 y401 w30 h20 Center -E0x200 Disabled vREDDECVALUE ,% REDDECVALUE
  166.     Gui, 3:Add,Edit,x68 y401 w30 h20 Center -E0x200 Disabled vGREENDECVALUE ,% GREENDECVALUE
  167.     Gui, 3:Add,Edit,x110 y401 w30 h20 Center -E0x200 Disabled vBLUEDECVALUE ,% BLUEDECVALUE
  168. }
  169. GETCOLORFROMSCREEN(){
  170.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  171.         RETURN
  172.     While(!GetKeyState("Ctrl")){
  173.         CoordMode,Mouse,Screen
  174.         CoordMode,Pixel,Screen
  175.         Tooltip, Press ""Ctrl"" to lock color. %OUTPUTCOLOR%
  176.         MouseGetPos,tcx,tcy
  177.         PixelGetColor,OUTPUTCOLOR,tcx,tcy,RGB
  178.         UPDATECOLORDISPLAYS(OUTPUTCOLOR)
  179.     }
  180.     ToolTip,
  181.     StringTrimLeft,OUTPUTCOLOR,OUTPUTCOLOR,2
  182.     Clipboard:=OUTPUTCOLOR
  183.     GuiControl,4:,SAVEDCOLOREDIT,% OUTPUTCOLOR
  184. }
  185. UPDATECOLORDISPLAYS(OUTPUTCOLOR){
  186.     StringTrimLeft,OUTPUTCOLOR,OUTPUTCOLOR,2
  187.     StringLeft , r ,  OUTPUTCOLOR , 2
  188.     StringTrimLeft,OUTPUTCOLOR,OUTPUTCOLOR,2
  189.     StringLeft , g ,  OUTPUTCOLOR , 2
  190.     StringTrimLeft,OUTPUTCOLOR,OUTPUTCOLOR,2
  191.     StringLeft , b ,  OUTPUTCOLOR , 2
  192.     r:= "0x" r,g:="0x" g,b:="0x" b
  193.     REDSLIDERVALUE:=r+0,GreenSLIDERVALUE:=g+0,BlueSLIDERVALUE:=b+0
  194.     GreyScaleSLIDERVALUE:=Round((REDSLIDERVALUE+GreenSLIDERVALUE+BlueSLIDERVALUE)/3)
  195.     GuiControl,3:,REDSLIDERVALUE,% REDSLIDERVALUE
  196.     GuiControl,3:,GreenSLIDERVALUE,% GreenSLIDERVALUE
  197.     GuiControl,3:,BlueSLIDERVALUE,% BlueSLIDERVALUE
  198.     GuiControl,3:,GreyScaleSLIDERVALUE,% GreyScaleSLIDERVALUE
  199.     UPDATERGBCOLORBLOCK(REDSLIDERVALUE,GreenSLIDERVALUE,BlueSLIDERVALUE,GreyScaleSLIDERVALUE)
  200. }
  201. ADJUST_SLIDER(){
  202.     Coordmode,Mouse,Client
  203.     SLIDERVALUE:=0
  204.     While(GETKEYSTATE("LButton")){
  205.         MouseGetPos,Rx,Ry
  206.         if(GETKEYSTATE("UP")){
  207.             if(ry-1>194)
  208.                 MouseMove,Rx,ry-1
  209.             KeyWait,Up,Up
  210.         }else if(GETKEYSTATE("Down")){
  211.             if(ry+1<451)
  212.                 MouseMove,Rx,ry+1
  213.             KeyWait,Down,Up
  214.         }else if(GETKEYSTATE("Left")){
  215.             if(ry+1<451)
  216.                 MouseMove,Rx,ry+1
  217.         }else if(GETKEYSTATE("Right")){
  218.             if(ry-1>194)
  219.                 MouseMove,Rx,ry-1
  220.         }
  221.         SLIDERVALUE:=(RY-195) * -1
  222.         (SLIDERVALUE < -255) ? (SLIDERVALUE:=-255) : (SLIDERVALUE > 0) ? (SLIDERVALUE:=0)
  223.         if(A_GuiControl="REDTRIGGER"){
  224.         REDSLIDERVALUE:=SLIDERVALUE+255
  225.         GuiControl,3:,REDSLIDERVALUE,% REDSLIDERVALUE
  226.         ToolTip,% REDSLIDERVALUE
  227.         }else if(A_GuiControl="GREENTRIGGER"){
  228.         GREENSLIDERVALUE:=SLIDERVALUE+255
  229.         GuiControl,3:,GREENSLIDERVALUE,% GREENSLIDERVALUE
  230.         ToolTip,% GREENSLIDERVALUE
  231.         }else if(A_GuiControl="BLUETRIGGER"){
  232.         BLUESLIDERVALUE:=SLIDERVALUE+255
  233.         GuiControl,3:,BLUESLIDERVALUE,% BLUESLIDERVALUE
  234.         ToolTip,% BLUESLIDERVALUE
  235.         }else if(A_GuiControl="GREYSCALETRIGGER"){
  236.         GREYSCALESLIDERVALUE:=SLIDERVALUE+255
  237.         GuiControl,3:,GREYSCALESLIDERVALUE,% GREYSCALESLIDERVALUE
  238.         ToolTip,% GREYSCALESLIDERVALUE
  239.         }
  240.         UPDATERGBCOLORBLOCK(REDSLIDERVALUE,GREENSLIDERVALUE,BLUESLIDERVALUE,GREYSCALESLIDERVALUE)
  241.     }
  242.     ToolTip,
  243. }
  244. Create_SUB_Window(){
  245.     Gui, 2: +Parent1 -DPIScale -Caption
  246.     Gui, 2: Color, 111111
  247.     DRAW_OUTLINE( 2 , 0 , 0 ,260  , 575, "444444" , "black" ),DRAW_OUTLINE( 2 , 1 , 1 ,258  , 573, "333333" , "111111" )
  248.     Gui, 2: Show,% "x30 y45 w" Main_Window.W-40 " h" Main_Window.H - 75
  249. }
  250. SETPICKERONTOP(){
  251.     WINGETTITLE,CWIN,A
  252.     IF(CWIN!="Najeeb Color Picker v2.0.1")
  253.         GUI,1:SHOW,NA
  254. }
  255. Create_Main_Window(){
  256.     Gui, 1: +AlwaysOnTop -DPIScale -Caption +LastFound
  257.     Winset,Transcolor,112343
  258.     Gui, 1: Color,112343
  259.     Gui,1:Font,caaaaaa s10 w600 , Segoe UI
  260.     pButton.Push(New Progress_Button("1",pButton.Length()+1,"Move_Window",floor((Main_Window.W-150)//2),10,150,30,"BLACK","777777","333333","003366","BLACK","Najeeb Color Picker",5))
  261.     pButton.Push(New Progress_Button("1",pButton.Length()+1,"RGBSUBWINDOW",6,60,23,120,"444444","777777","333333","003366","003388","M`nI`nX`nE`nR",15))
  262.     pButton.Push(New Progress_Button("1",pButton.Length()+1,"SAVEDSUBWINDOW",6,190,23,120,"444444","777777","333333","003366","003388","S`nA`nV`nE`nD",15))
  263.     pButton.Push(New Progress_Button("1",pButton.Length()+1,"RANDOMSUBWINDOW",6,320,23,120,"444444","777777","333333","003366","003388","R`nA`nN`nD`nO`nM",8))
  264.     pButton.Push(New Progress_Button("1",pButton.Length()+1,"GETCOLORFROMSCREEN",75,530,170,30,"111111","777777","252525","008833","992222","GET COLOR",5))
  265.     Gui, 1: Show,% "x" Main_Window.X " y" Main_Window.Y " w" Main_Window.W " h" Main_Window.H , Najeeb Color Picker v2.0.1
  266. }
  267. CREATE_RANDOM_WINDOW(){
  268.     Gui, 5: +Parent2 -DPIScale -Caption
  269.     Gui, 5: Color, 222222,333333
  270.     DRAW_OUTLINE( 5 , 0 , 0 ,250  , 470 , "444444" , "black" ),DRAW_OUTLINE( 5 , 1 , 1 ,248  , 468 , "333333" , "111111" )
  271.     Gui,5:Font,cdddddd s10 ,Segoe Ui
  272.     Gui,5:Add,Text,cRed x15 y5 w65 h18 BackgroundTrans Center ,RED
  273.     Gui,5:Add,Text,cGreen x90 y5 w65 h18 BackgroundTrans Center ,GREEN
  274.     Gui,5:Add,Text,c0055ff x165 y5 w65 h18 BackgroundTrans Center ,BLUE
  275.     Gui,5:Add,Edit,x15 y25 w30 h18 -e0x200  Center Number Limit3 vREDMIN1 gSUBMIT_5 , % REDMIN1
  276.     Gui,5:Add,Edit,x50 y25 w30 h18 -e0x200  Center Number Limit3 vREDMAX1 gSUBMIT_5 , % REDMAX1
  277.     Gui,5:Add,Edit,x90 y25 w30 h18 -e0x200  Center Number Limit3 vGREENMIN1 gSUBMIT_5 , % GREENMIN1
  278.     Gui,5:Add,Edit,x125 y25 w30 h18 -e0x200  Center Number Limit3 vGREENMAX1  gSUBMIT_5 , % GREENMAX1
  279.     Gui,5:Add,Edit,x165 y25 w30 h18 -e0x200  Center Number Limit3 vBLUEMIN1 gSUBMIT_5 , % BLUEMIN1
  280.     Gui,5:Add,Edit,x200 y25 w30 h18 -e0x200  Center Number Limit3 vBLUEMAX1 gSUBMIT_5 , % BLUEMAX1
  281.     pButton.Push(New Progress_Button("5",pButton.Length()+1,"Create_RANDOM_SET",60,200,130,20,"BLACK","777777","333333","003366","BLACK","GENERATE",0))
  282.     Gui,5:Add,Text,cRed x15 y225 w65 h18 BackgroundTrans Center ,RED
  283.     Gui,5:Add,Text,cGreen x90 y225 w65 h18 BackgroundTrans Center ,GREEN
  284.     Gui,5:Add,Text,c0055ff x165 y225 w65 h18 BackgroundTrans Center ,BLUE
  285.     Gui,5:Add,Edit,x15 y245 w30 h18 -e0x200  Center Number Limit3 vREDMIN2 gSUBMIT_5 , % REDMIN2
  286.     Gui,5:Add,Edit,x50 y245 w30 h18 -e0x200  Center Number Limit3 vREDMAX2 gSUBMIT_5 , % REDMAX2
  287.     Gui,5:Add,Edit,x90 y245 w30 h18 -e0x200  Center Number Limit3 vGREENMIN2 gSUBMIT_5 , % GREENMIN2
  288.     Gui,5:Add,Edit,x125 y245 w30 h18 -e0x200  Center Number Limit3 vGREENMAX2  gSUBMIT_5 , % GREENMAX2
  289.     Gui,5:Add,Edit,x165 y245 w30 h18 -e0x200  Center Number Limit3 vBLUEMIN2 gSUBMIT_5 , % BLUEMIN2
  290.     Gui,5:Add,Edit,x200 y245 w30 h18 -e0x200  Center Number Limit3 vBLUEMAX2 gSUBMIT_5 , % BLUEMAX2
  291.     pButton.Push(New Progress_Button("5",pButton.Length()+1,"Create_RANDOM_SET",60,440,130,20,"BLACK","777777","333333","003366","BLACK","GENERATE",0))
  292.     Gui, 5: Show,x7 y10 w250 h470
  293. }
  294. SUBMIT_5(){
  295.     Gui,5:Submit,NoHide
  296. }
  297. Create_RANDOM_SET(){
  298.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  299.         RETURN
  300.     (A_GuiControl=11)?(GENERATERANDOMCOLORWINDOWS(6,REDMIN1,REDMAX1,GREENMIN1,GREENMAX1,BLUEMIN1,BLUEMAX1,50,7))
  301.     :(A_GuiControl=12)?(GENERATERANDOMCOLORWINDOWS(7,REDMIN2,REDMAX2,GREENMIN2,GREENMAX2,BLUEMIN2,BLUEMAX2,270,8))
  302. }
  303. GENERATERANDOMCOLORWINDOWS(genWindow,RMIN,RMAX,GMIN,GMAX,BMIN,BMAX,yttt,lc){
  304.     Gui,% genWindow ": Destroy"
  305.     Gui,% genWindow ": +Parent5 -Caption -DPISCALE"
  306.     Gui,% genWindow ":Color" ,222222
  307.     y:=0,tw:=20,th:=tw
  308.     Loop, % LC  {
  309.         x:=0
  310.         Loop, 10    {
  311.             RandomColor:=Random_Colour(RMIN,RMAX,GMIN,GMAX,BMIN,BMAX)
  312.             Gui,% genWindow ": Add" ,Progress,x%x% y%y% w%tw% h%th% Background%RandomColor%
  313.             x+=tw
  314.         }
  315.         y+=th  
  316.     }
  317.     Gui,% genWindow ": Show",x25 y%yttt% w200 h160
  318. }
  319. ADD_MIXER_BUTTONS(){
  320.     pButton.Push(New Progress_Button("3",pButton.Length()+1,"CLIPRGB",20,438,100,20,"111111","777777","252525","880000","992222","CLIP RGB",1))
  321.     pButton.Push(New Progress_Button("3",pButton.Length()+1,"CLIPGREYSCALE",130,438,100,20,"111111","777777","252525","880000","992222","CLIP GREY",1))
  322.     DRAW_LINE( 3 , 21 , 458 , 100 , 1 , "222222" ),DRAW_LINE( 3 , 120 , 439 , 1 , 20 , "222222" ),DRAW_LINE( 3 , 131 , 458 , 100 , 1 , "222222" ),DRAW_LINE( 3 , 230 , 439 , 1 , 20 , "222222" )
  323. }
  324. RGBSUBWINDOW(){
  325.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  326.         RETURN
  327.     GUI,3:Show
  328.     Gui,4:Hide
  329.     Gui,5:Hide
  330. }
  331. SAVEDSUBWINDOW(){
  332.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  333.         RETURN
  334.     GUI,4:Show
  335.     Gui,3:Hide
  336.     Gui,5:Hide
  337. }
  338. RANDOMSUBWINDOW(){
  339.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  340.         RETURN
  341.     GUI,5:Show
  342.     Gui,3:Hide
  343.     Gui,4:Hide
  344. }
  345. CLIPRGB(){
  346.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  347.         RETURN
  348.     Clipboard := RGBCOLORBLOCK
  349.     GuiControl,4:,SAVEDCOLOREDIT,% RGBCOLORBLOCK
  350. }
  351. CLIPGREYSCALE(){
  352.     IF( !PBUTTON[ A_GUICONTROL ].BUTTON_PRESS() )
  353.         RETURN
  354.     Clipboard := GREYSCALECOLORBLOCK
  355.     GuiControl,4:,SAVEDCOLOREDIT,% GREYSCALECOLORBLOCK
  356. }
  357. UPDATERGBCOLORBLOCK(REDSLIDERVALUEt,GREENSLIDERVALUEt,BLUESLIDERVALUEt,GREYSCALESLIDERVALUEt){
  358.     GuiControl,3:,GREYSCALEDECVALUE,% GREYSCALESLIDERVALUEt
  359.     GuiControl,3:,REDDECVALUE,% REDSLIDERVALUEt
  360.     GuiControl,3:,GREENDECVALUE,% GREENSLIDERVALUEt
  361.     GuiControl,3:,BLUEDECVALUE,% BLUESLIDERVALUEt
  362.     SETFORMAT , INTEGER , HEX
  363.     REDSLIDERVALUEt += 0 , GREENSLIDERVALUEt += 0 , BLUESLIDERVALUEt += 0 , GREYSCALESLIDERVALUEt += 0
  364.     StringTrimLeft,GREYSCALESLIDERVALUEt,GREYSCALESLIDERVALUEt,2
  365.     StringTrimLeft,REDSLIDERVALUEt,REDSLIDERVALUEt,2
  366.     StringTrimLeft,GREENSLIDERVALUEt,GREENSLIDERVALUEt,2
  367.     StringTrimLeft,BLUESLIDERVALUEt,BLUESLIDERVALUEt,2
  368.     SETFORMAT , INTEGER , DECIMAL
  369.     (strlen(GREYSCALESLIDERVALUEt)=1)?(GREYSCALESLIDERVALUEt:="0" GREYSCALESLIDERVALUEt)
  370.     (strlen(REDSLIDERVALUEt)=1)?(REDSLIDERVALUEt:="0" REDSLIDERVALUEt)
  371.     (strlen(GREENSLIDERVALUEt)=1)?(GREENSLIDERVALUEt:="0" GREENSLIDERVALUEt)
  372.     (strlen(BLUESLIDERVALUEt)=1)?(BLUESLIDERVALUEt:="0" BLUESLIDERVALUEt)
  373.     GuiControl,3:,GREYSCALEHEXVALUE,% GREYSCALESLIDERVALUEt
  374.     GREYSCALESLIDERVALUEt.= GREYSCALESLIDERVALUEt GREYSCALESLIDERVALUEt
  375.     GREYSCALECOLORBLOCK := GREYSCALESLIDERVALUEt
  376.     GuiControl,3:,REDHEXVALUE,% REDSLIDERVALUEt
  377.     GuiControl,3:,GREENHEXVALUE,% GREENSLIDERVALUEt
  378.     GuiControl,3:,BLUEHEXVALUE,% BLUESLIDERVALUEt
  379.     RGBCOLORBLOCK:= REDSLIDERVALUEt . GREENSLIDERVALUEt . BLUESLIDERVALUEt
  380.     GuiControl, 3: +c%RGBCOLORBLOCK% , RGBCOLORBLOCK,
  381.     GuiControl, 3: +c%GREYSCALECOLORBLOCK% , GREYSCALECOLORBLOCK,
  382. }
  383. ADD_COLOR_DISPLAYS(){
  384.     Gui,3:Add,Progress,x7 y6 w235 h100 Background222222
  385.     DRAW_OUTLINE( 3 , 6 , 5 , 237 , 102 , "444444" , "black" )
  386.     Gui, 3:Add,Progress,x20 y15 w130 h80 BackgroundBlack c%RGBCOLORBLOCK% vRGBCOLORBLOCK, 100
  387.     DRAW_OUTLINE( 3 , 19 , 14 , 132 , 82 , "111111" , "111111" )
  388.     Gui, 3:Add,Progress,x160 y15 w70 h80 BackgroundBlack c%GREYSCALECOLORBLOCK% vGREYSCALECOLORBLOCK, 100
  389.     DRAW_OUTLINE( 3 , 159 , 14 , 72 , 82 , "111111" , "111111" )
  390. }
  391. Random_Colour(Range_R_Min:=0,Range_R_Max:=255,Range_G_Min:=0,Range_G_Max:=255,Range_B_Min:=0,Range_B_Max:=255){
  392.      RGBCOLOR := { 1 : ( Random( Range_R_Min , Range_R_Max ) ) , 2 : Random( Range_G_Min , Range_G_Max ) , 3 : Random( Range_B_Min , Range_B_Max ) }
  393.     FOR COLOR IN RGBCOLOR   {
  394.         SETFORMAT , INTEGER , HEX
  395.         RGBCOLOR[ A_INDEX ] += 0
  396.         TEMP := RGBCOLOR[A_INDEX]
  397.         STRINGREPLACE , TEMP , TEMP , 0x
  398.         RGBCOLOR[A_INDEX] := TEMP
  399.         SETFORMAT , INTEGER , DECIMAL  
  400.         IF( STRLEN( RGBCOLOR[ A_INDEX ] ) < 2 )
  401.             RGBCOLOR[ A_INDEX ] := "0" RGBCOLOR[ A_INDEX ]
  402.         TEMPCOLOR .= RGBCOLOR[ A_INDEX ]
  403.     }
  404.     RETURN TEMPCOLOR
  405. }
  406. Random(MIN,MAX){
  407.     Random,OUTPUT,MIN,MAX
  408.     return OUTPUT
  409. }
  410. pButton_StartUp(){
  411.     SetTimer,Watch_Hover,10
  412. }
  413. Watch_Hover(){
  414.     global
  415.     if(Press_active=0){
  416.         if(Hover_On=0){
  417.             MouseGetPos,,,,ctrl,2
  418.             loop,% pButton.Length() {
  419.                 GuiControlGet,cName,% pButton[A_Index].Window_Name ":Name",% ctrl
  420.                 cut:=Strlen(cName)
  421.                 StringLeft,bName,cName,cut-2
  422.                     if(bname=pButton[A_Index].Button_Name){
  423.                         pButton[A_Index].Button_Hover_On()
  424.                         Hover_On:=1,Active_Button:=bname,win:=pButton[A_Index].Window_Name
  425.                         return
  426.                     }
  427.             }
  428.         }else if(Hover_On=1){
  429.             MouseGetPos,,,,ctrl,2
  430.             GuiControlGet,cName,%win%:Name,% ctrl
  431.             cut:=Strlen(cName)
  432.             StringLeft,nBName,cName,cut-2
  433.             if(NbName!=Active_Button){
  434.                 pButton[Active_Button].Button_Hover_Off(),Hover_On:=0,Active_Button:=""
  435.             }
  436.         }
  437.     }
  438. }
  439. Class Progress_Button   {
  440.     __New(Window_Name,Button_Name,Label,x,y,w,h,BC,TRC,TC1,TC2,TC3,Button_Text,Text_Offset:=0){
  441.         This.Text_Offset:=Text_Offset,This.Window_Name:=Window_Name,This.Button_Name:=Button_Name,This.Label:=Label
  442.         This.Button_ID1:=Button_Name "_1",This.Button_ID2:=Button_Name "_2",This.Button_ID3:=Button_Name "_3",This.Button_ID4:=Button_Name "_4"
  443.         This.Button_Text:=Button_Text,This.X:=x,This.Y:=y,This.W:=w,This.H:=h
  444.         This.Bottom_Color:=BC,This.Trim_Color:=TRC,This.Top_Color_1:=TC1,This.Top_Color_2:=TC2,This.Top_Color_3:=TC3
  445.         This.Add_Button()
  446.     }
  447.     Add_Button(){
  448.         global
  449.         Gui,% This.Window_Name ":Add",Text,% "x" This.X " y" This.Y " w" This.W " h" This.H " v" This.Button_Name " g" This.Label
  450.         Gui,% This.Window_Name ":Add",Progress,% "x" This.X " y" This.Y " w" This.W " h" This.H " Background" This.Bottom_Color " v" This.Button_ID1
  451.         Gui,% This.Window_Name ":Add",Progress,% "x" This.X " y" This.Y " w" This.W-1 " h" This.H-1 " Background" This.Trim_Color " v" This.Button_ID2
  452.         Gui,% This.Window_Name ":Add",Progress,% "x" This.X+1 " y" This.Y+1 " w" This.W-2 " h" This.H-2 " Background" This.Top_Color_1 " v" This.Button_ID3
  453.         Gui,% This.Window_Name ":Add",Text,% "x" This.X+1 " y" This.Y+This.Text_Offset " w" This.W-2 "  Center BackgroundTrans v" This.Button_ID4,% This.Button_Text
  454.     }
  455.     Button_Press(){
  456.         global
  457.         Press_Active:=1
  458.         GuiControl,% This.Window_Name ":Move",% This.Button_ID4,% "x" This.X+1 " y" This.Y+1+This.Text_Offset
  459.         sleep,-1
  460.         GuiControl,% This.Window_Name ":Hide",This.Button_ID2
  461.         GuiControl,% This.Window_Name ":+Background" This.Top_Color_3,% This.Button_ID3
  462.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID1
  463.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID3
  464.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID4
  465.         While(GetKeyState("LButton"))
  466.             Sleep, 10
  467.         MouseGetPos,,,,ctrl,2
  468.         GuiControlGet,cName,% win ":Name",% ctrl
  469.         cut:=Strlen(cName)
  470.         StringLeft,bName,cName,cut-2
  471.         if(bname=This.Button_Name){
  472.             GuiControl,% This.Window_Name ":Show",This.Button_ID2
  473.             GuiControl,% This.Window_Name ":+Background" This.Top_Color_1,% This.Button_ID3
  474.             GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID1
  475.             GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID2
  476.             GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID3
  477.             GuiControl,% This.Window_Name ":Move",% This.Button_ID4,% "x" This.X " y" This.Y+This.Text_Offset
  478.             GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID4
  479.             %bName%.Button_Hover_On(),Hover_On:=0,Active_Button:=bname,Press_Active:=0
  480.             sleep,10
  481.             return true
  482.         }
  483.         GuiControl,% This.Window_Name ":Show",This.Button_ID2
  484.         GuiControl,% This.Window_Name ":Move",% This.Button_ID4,% "x" This.X " y" This.Y+This.Text_Offset
  485.         GuiControl,% This.Window_Name ":+Background" This.Top_Color_1,% This.Button_ID3
  486.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID1
  487.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID2
  488.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID3
  489.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID4
  490.         Hover_On:=0,Press_Active:=0
  491.         sleep,10
  492.         return False
  493.     }
  494.     Button_Hover_On(){
  495.         global
  496.         GuiControl,% This.Window_Name ":+Background" This.Top_Color_2,% This.Button_ID3
  497.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID4
  498.     }
  499.     Button_Hover_Off(){
  500.         global
  501.         GuiControl,% This.Window_Name ":+Background" This.Top_Color_1,% This.Button_ID3
  502.         GuiControl,% This.Window_Name ":+Redraw",% This.Button_ID4
  503.     }
  504. }
  505. ESC::ExitApp
Add Comment
Please, Sign In to add comment