Guest User

Untitled

a guest
Jul 21st, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. resizehook(hwnd)
  2. {
  3. global id, id0, id1, id2, id3, id4, id5, id6, id7, id8, id9
  4. global moving
  5. global X,Y,H,W
  6. WinGet, id, list
  7. SetTimer, ResizeWindow, -1
  8.  
  9. Loop {
  10. if (moving == 0) {
  11. ToolTip
  12. break
  13. }
  14.  
  15.  
  16. WinGetPos, X, Y, W, H, ahk_id %hwnd%
  17. sleep, 10
  18. }
  19. }
  20.  
  21. resize(this_id)
  22. {
  23. global ConfigFile
  24. IniRead, cont, %ConfigFile%, Group1, %this_id%, 0
  25.  
  26. if (cont != 1) {
  27. return
  28. }
  29.  
  30.  
  31. global moving
  32. global X,Y,H,W
  33.  
  34. Loop {
  35. Sleep, 10
  36. if (moving == 0) {
  37. break
  38. }
  39. WinGetPos, X2, Y2, W2, H2, ahk_id %this_id%
  40. DX1 := X + W - X2
  41. DY1 := Y + H - Y2
  42. DX2 := X2 + W2 - X
  43. DY2 := Y2 + H2 - Y
  44.  
  45. ToolTip, %X%x%Y% %H%x%W% %X2%x%Y2% %H2%x%W2% %DX1%x%DY1% %DX2%x%DY2%, 0, 0
  46. if (0) {
  47. if (DX1 < 50) {
  48. NX := X2 + DX1
  49. ToolTip, %NX%, 0, 0
  50. WinMove, ahk_id %this_id%,, NX, Y2, W2, H2
  51. } else
  52. if (DY1 < 50) {
  53. NY := Y2 + DY1
  54. ToolTip, %NY%, 0, 0
  55. WinMove, ahk_id %this_id%,, X2, NY, W2, H2
  56. } else
  57. if (DX2 < 50) {
  58. NX := X2 - DX2
  59. ToolTip, %NX%, 0, 0
  60. WinMove, ahk_id %this_id%,, NX, Y2, W2, H2
  61. } else
  62. if (DY2 < 50) {
  63. NY := Y2 - DY2
  64. ToolTip, %NY%, 0, 0
  65. WinMove, ahk_id %this_id%,, X2, NY, W2, H2
  66. }
  67. } else {
  68. if (DX1 < 50) {
  69. NX := X2 + DX1
  70. NW := W2 - DX1
  71. ToolTip, %NX% %NW%, 0, 0
  72. WinMove, ahk_id %this_id%,, NX, Y2, NW, H2
  73. } else
  74. if (DY1 < 50) {
  75. NY := Y2 + DY1
  76. NH := H2 - DY1
  77. ToolTip, %NY% %NH%, 0, 0
  78. WinMove, ahk_id %this_id%,, X2, NY, W2, NH
  79. } else
  80. if (DX2 < 50) {
  81. NW := W2 - DX2
  82. ToolTip, %NX%, 0, 0
  83. WinMove, ahk_id %this_id%,, X2, Y2, NW, H2
  84. } else
  85. if (DY2 < 50) {
  86. NH := H2 - DY2
  87. ToolTip, %NY%, 0, 0
  88. WinMove, ahk_id %this_id%,, X2, Y2, W2, NH
  89. }
  90. }
  91. }
  92. }
  93.  
  94.  
  95. #Insert::
  96. WinGet,window,ID,A
  97. GroupAdd, Docker, ahk_id %window%
  98. IniWrite, 1, %ConfigFile%, Group1, %window%
  99. ToolTip, Adding %window%, 0, 0
  100. Sleep, 1000
  101. ToolTip
  102. return
  103.  
  104. #Delete::
  105. WinGet,window,ID,A
  106. ;GroupAdd, Docker, ahk_group Docker,,,ahk_id %window%
  107. IniWrite, 0, %ConfigFile%, Group1, %window%
  108. ToolTip, Removing %window%, 0, 0
  109. Sleep, 1000
  110. ToolTip
  111. return
  112.  
  113. ResizeWindow:
  114. if (!id && !moving) {
  115. return
  116. }
  117.  
  118. this := id%id%
  119.  
  120. resize(this)
  121. id := id - 1
  122.  
  123. SetTimer, ResizeWindow, -1
  124. return
Add Comment
Please, Sign In to add comment