JacobMIX

Moonlight community (host) AHK script

Jul 3rd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. #SingleInstance, Force
  2. #MaxHotkeysPerInterval 2000
  3. F13::LAlt
  4. F14::<^>! ;AltGr
  5. F15::LCtrl
  6. F16::LShift
  7. F17::LWin
  8. F18::PrintScreen
  9. <!<^<+Q::Process, Close, nvstreamer.exe ;LAlt+LCtrl+LShift+Q to close stream.
  10.  
  11. ;Your monitor resolutions. (Needed for moving windows between screens in the script below)
  12. leftMonitorWidth = 1920
  13. leftMonitorHeight = 1080
  14. rightMonitorWidth = 1920
  15. rightMonitorHeight = 1080
  16.  
  17. <!<+P:: ; LAlt + LShift + P
  18. activeWindow := WinActive("A")
  19. if activeWindow = 0
  20. {
  21. return
  22. }
  23. WinGet, minMax, MinMax, ahk_id %activeWindow%
  24. if minMax = 1
  25. {
  26. WinRestore, ahk_id %activeWindow%
  27. }
  28. WinGetPos, x, y, width, height, ahk_id %activeWindow%
  29. if x < 0
  30. {
  31. xScale := rightMonitorWidth / leftMonitorWidth
  32. yScale := rightMonitorHeight / leftMonitorHeight
  33. x := leftMonitorWidth + x
  34. newX := x * xScale
  35. newY := y * yScale
  36. newWidth := width * xScale
  37. newHeight := height * yScale
  38. }
  39. else
  40. {
  41. xScale := leftMonitorWidth / rightMonitorWidth
  42. yScale := leftMonitorHeight / rightMonitorHeight
  43. newX := x * xScale
  44. newY := y * yScale
  45. newWidth := width * xScale
  46. newHeight := height * yScale
  47. newX := newX - leftMonitorWidth
  48. }
  49. WinMove, ahk_id %activeWindow%, , %newX%, %newY%, %newWidth%, %newHeight%
  50. if minMax = 1
  51. {
  52. WinMaximize, ahk_id %activeWindow%
  53. }
  54. WinActivate ahk_id %activeWindow% ;Needed - otherwise another window may overlap it
  55. return
  56.  
  57. OnExit, Terminate
  58. Terminate:
  59. Process, Close, nvstreamer.exe
  60. #Persistent ; For demonstration purposes, keep the script running if the user chooses "No".
  61. KeyList := "CapsLock|Space|Tab|Enter|Esc|Backspace|ScrollLock|Delete|Insert|Home|End|PgUp|PgDn|Up|Down|Left|Right|Numpad0|Numpad1|Numpad2|Numpad3|Numpad4|Numpad5|Numpad6|Numpad7|Numpad9|NumpadDot|NumLock|NumpadDiv|NumpadMult|NumpadAdd|NumpadSub|NumpadEnter|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|LWin|RWin|Win|LControl|RControl|Control|LAlt|RAlt|Alt|<^>!|LShift|RShift|Shift|PrintScreen|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|æ|ø|å|1|2|3|4|5|6|7|8|9|0" ; and so on
  62. Loop, Parse, KeyList, |
  63. {
  64. If GetKeystate(A_Loopfield, "P")
  65. Send % "{" A_Loopfield " Up}"
  66. }
  67. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment