Advertisement
Najeebsk

FOLDER-MAKE-WITH-ICON.ahk

Sep 9th, 2022 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; <COMPILER: v1.1.34.03>
  2. #NoEnv
  3. #SingleInstance, Force
  4. SetBatchLines, -1
  5. #NoTrayIcon
  6. SetWorkingDir %A_ScriptDir%  
  7. IfNotExist, %A_ScriptDir%\F-ICONS
  8. FileCreateDir, %A_ScriptDir%\F-ICONS
  9. FileSetAttrib +HS, %A_ScriptDir%\F-ICONS, 2
  10. #Include, %A_ScriptDir%\MyFileInstall.txt
  11. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  12. Gui -Caption +ToolWindow +Border +LastFound +AlwaysOnTop -Border +hWndhGUI
  13. CustomColor = 884488
  14. Gui, Color, %CustomColor%
  15. Gui,Font,cwhite S14 Bold,Verdana ;Calibri
  16. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  17.  
  18. Gui, Add, Button, hWndhButton2 x5 y5 w0 h0 gGuiMove,
  19. Gui, Add,Text, x50 y10, ~~~*** NAJEEB FOLDER MAKER ***~~~
  20. Gui,Font,cyellow S12 Bold,Verdana ;Calibri
  21. Gui, Add,Text, x20 y52,Enter Folder Name:-
  22. Gui, Add,Edit, x210 y50 vFol hwndHED1,
  23. CtlColor_Edit(HED1, 0xFF22FF, 0xFFFFFF)
  24. Gui,Font,cyellow S12 Bold,Verdana ;Calibri
  25. Gui, Add,Text, x20 y86,Enter Icon Number:-
  26. Gui, Add,Edit, x210 y84 vIco hwndHED2,
  27. CtlColor_Edit(HED2, 0x8282e3, 0x000000)
  28. Gui,Font,cyellow S8 Bold,Verdana ;Calibri
  29. Gui, Add,Button, x427 y86 gMake,Make Folder Icon
  30. Gui,add,Picture, x410 y36 vActualIcon Icon1 w48 h48 ,
  31. Gui,Font,cyellow S8 Bold,Verdana ;Calibri
  32. Gui, Add,Button, x470 y46 gViwe,ICON VIWE
  33. Gui, Show, x0 y30 w600 h140 Center, NAJEEB FOLDER MAKER
  34. WinSet, Region, 0-0 W600 H140 R20-20,
  35. WinMove, 0, 0
  36. OnMessage( 0x200, "WM_MOUSEMOVE")
  37. Return
  38. Viwe:
  39. Gui, Submit, nohide
  40. GuiControl,, ActualIcon, %A_ScriptDir%\F-ICONS\%Ico%.ico
  41. Run, "%A_ScriptDir%\F-ICONS\ICONS.jpg"
  42. Return
  43. Make:
  44. Gui, Submit, nohide
  45. FileCreateDir %Fol% ; (optional: create a new folder)
  46.  
  47. FileSetAttrib +S, %Fol%, 2
  48.  
  49. ini=%Fol%\desktop.ini
  50. ;IniWrite %A_AhkPath%, %ini%, .ShellClassInfo, IconFile
  51. IniWrite %A_ScriptDir%\F-ICONS\%Ico%.ico, %ini%, .ShellClassInfo, IconFile
  52. IniWrite 0          , %ini%, .ShellClassInfo, IconIndex
  53. IniWrite 0          , %ini%, .ShellClassInfo, ConfirmFileOp
  54. FileSetAttrib +HS, %ini%, 2
  55. FileCopy, %A_ScriptDir%\F-ICONS\%Ico%.ico, %Fol%\
  56. FileSetAttrib +HS, %Fol%\%Ico%.ico, 2
  57. Return
  58.  
  59. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60. GuiMove:
  61.  PostMessage, 0xA1, 2,,, NAJEEB SCRIPT BOOK
  62. Return
  63. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  64. WM_MOUSEMOVE(wparam, lparam, msg, hwnd)
  65. {
  66.     if wparam = 1 ; LButton
  67.         PostMessage, 0xA1, 2,,, A ; WM_NCLBUTTONDOWN
  68. }
  69. ; ======================================================================================================================
  70. ; WM_CTLCOLOREDIT = 0x0133 <- msdn.microsoft.com/en-us/library/windows/desktop/bb761691(v=vs.85).aspx
  71. ; An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window
  72. ; when the control is about to be drawn.
  73. ; ======================================================================================================================
  74. CtlColor_Edit(Param1, Param2 := "", Param3 := "") {
  75.    Static Init := OnMessage(0x0133, "CtlColor_Edit")
  76.    Static DCBrush := DllCall("Gdi32.dll\GetStockObject", "UInt", 18, "UPtr") ; DC_BRUSH = 18
  77.    Static Controls := []
  78.    ; If Param1 contains a valid window handle, the function has been called by the user ---------------------------------
  79.    ; Param1 = HWND, Param2 = BackgroundColor, Param3 = TextColor
  80.    If DllCall("IsWindow", "Ptr", Param1, "UInt") {
  81.       Controls.Delete(Param1)
  82.       If (Param2 <> "") {
  83.          Controls[Param1, "BkColor"] := CtlColor_BGR(Param2)
  84.          If (Param3 <> "")
  85.             Controls[Param1, "TxColor"] := CtlColor_BGR(Param3)
  86.       }
  87.    }
  88.    ; Function has been called as message handler -----------------------------------------------------------------------
  89.    ; Param1 (wParam) = HDC, Param2 (lParam) = HWND
  90.    Else If (((BC := Controls[Param2, "BkColor"]) . (TC := Controls[Param2, "TxColor"])) <> "") {
  91.       If (TC <> "")
  92.          DllCall("SetTextColor", "Ptr", Param1, "UInt", TC)
  93.       DllCall("SetBkColor", "Ptr", Param1, "UInt", BC)
  94.       DllCall("SetDCBrushColor", "Ptr", Param1, "UInt", BC)
  95.       Return DCBrush
  96.    }
  97. }
  98. ; ======================================================================================================================
  99. ; Color values must be passed as BGR to GDI functions, this function does the conversion from RGB
  100. ; ======================================================================================================================
  101. CtlColor_BGR(RGB) {
  102.    Static HTML := {AQUA: 0xFFFF00, BLACK: 0x000000, BLUE: 0xFF0000, FUCHSIA: 0xFF00FF, GRAY: 0x808080, GREEN: 0x008000
  103.                  , LIME: 0x00FF00, MAROON: 0x000080, NAVY: 0x800000, OLIVE: 0x008080, PURPLE: 0x800080, RED: 0x0000FF
  104.                  , SILVER: 0xC0C0C0, TEAL: 0x808000, WHITE: 0xFFFFFF, YELLOW: 0x00FFFF}
  105.    Return (HTML.HasKey(RGB) ? HTML[RGB] : ((RGB >> 16) & 0x0000FF) + (RGB & 0x00FF00) + ((RGB & 0x0000FF) << 16))
  106. }
  107. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  108. #R::Reload  ;<--  ~ Reload Script ~
  109. #S::Suspend ;<--  ~ Suspend Script ~
  110. #P::Pause   ;<--  ~ Pause Script ~
  111. #M::WinMinimize, ;<--  ~ Minimize Script ~
  112. ESC::ExitApp     ;<--  ~ Exit Script ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement