Advertisement
Guest User

AutoHotkey Ridimensionare Finestre

a guest
Mar 30th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. ; Spostare Finestre Windows con ALT
  2.  
  3. ~Alt & LButton::
  4. CoordMode, Mouse ; Switch to screen/absolute coordinates.
  5. MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
  6. WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
  7. WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
  8. SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
  9. return
  10.  
  11. EWD_WatchMouse:
  12. GetKeyState, EWD_LButtonState, LButton, P
  13. if EWD_LButtonState = U ; Button has been released, so drag is complete.
  14. {
  15. SetTimer, EWD_WatchMouse, off
  16. return
  17. }
  18.  
  19. GetKeyState, EWD_EscapeState, Escape, P
  20. if EWD_EscapeState = D ; Escape has been pressed, so drag is cancelled.
  21. {
  22. SetTimer, EWD_WatchMouse, off
  23. WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
  24. return
  25. }
  26.  
  27. ; Otherwise, reposition the window to match the change in mouse coordinates
  28. ; caused by the user having dragged the mouse:
  29. CoordMode, Mouse
  30. MouseGetPos, EWD_MouseX, EWD_MouseY
  31. WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
  32. SetWinDelay, -1 ; Makes the below move faster/smoother.
  33. WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
  34. EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine.
  35. EWD_MouseStartY := EWD_MouseY
  36. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement