Advertisement
Guest User

Untitled

a guest
Jan 5th, 2019
945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn ; Enable warnings to assist with detecting common errors.
  3. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  5. ScriptVersion = 1.1
  6. #Singleinstance,force
  7.  
  8. GoSub, MainProgram
  9. return
  10.  
  11. mainprogram:
  12. SetTitleMatchMode, 2
  13. WinGet, id, list, - VLC media player,, Program Manager
  14. Windows =
  15. Loop, %id%
  16. {
  17. StringTrimRight, this_id, id%a_index%, 0
  18. Windows := this_id . "," . Windows
  19. }
  20. StringTrimRight, Windows, Windows, 1
  21.  
  22. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  23. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  24.  
  25. ~]::LoopControlSend(Windows, "]")
  26. ~[::LoopControlSend(Windows, "[")
  27. ~j::LoopControlSend(Windows, "j")
  28. ~k::LoopControlSend(Windows, "k")
  29. ~space::LoopControlSend(Windows, "{space}")
  30.  
  31. ~+left::LoopControlSend(Windows, "+{left}")
  32. ~!left::LoopControlSend(Windows, "!{left}")
  33. ~^left::LoopControlSend(Windows, "^{left}")
  34. ~+right::LoopControlSend(Windows, "+{right}")
  35. ~!right::LoopControlSend(Windows, "!{right}")
  36. ~^right::LoopControlSend(Windows, "^{right}")
  37. ~^up::LoopControlSend(Windows, "^{up}")
  38. ~^down::LoopControlSend(Windows, "^{down}")
  39.  
  40. ; for active windows only. use this to adjust speed when out of sync
  41. ~left::ActiveWindowSend(Windows, "+{left}")
  42. ~right::ActiveWindowSend(Windows, "+{right}")
  43. ~up::ActiveWindowSend(Windows, "^{left}")
  44. ~down::ActiveWindowSend(Windows, "^{right}")
  45. return
  46.  
  47. LoopControlSend(Windows, x)
  48. {
  49. WinGet, active_id, ID, A
  50.  
  51. is_valid_window = 0
  52. Loop,Parse,Windows,CSV
  53. {
  54. if active_id = %A_LoopField%
  55. {
  56. is_valid_window = 1
  57. break
  58. }
  59. }
  60.  
  61. if is_valid_window
  62. {
  63. Loop,Parse,Windows,CSV
  64. {
  65. if active_id <> %A_LoopField%
  66. {
  67. ControlSend, , %x%, Ahk_Id %A_LoopField%
  68. }
  69. }
  70. }
  71. }
  72.  
  73. ActiveWindowSend(Windows, x)
  74. {
  75. WinGet, active_id, ID, A
  76.  
  77. is_valid_window = 0
  78. Loop,Parse,Windows,CSV
  79. {
  80. if active_id = %A_LoopField%
  81. {
  82. is_valid_window = 1
  83. break
  84. }
  85. }
  86.  
  87. if is_valid_window
  88. {
  89. SendInput, %x%
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement