von_Elsewhere

Space Pass - Plugin Space Bypass (BwS6 ready)

Dec 18th, 2024 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 2.46 KB | Software | 0 0
  1. ; If your plugins grab keyboard, this is it.
  2. ; This script bypasses space bar presses from Bitwig's plugin host windows
  3. ; to Bitwig's main window. The behavior can be enabled and disabled by
  4. ; pressing Control-Win-Alt-Space key combination.
  5. ; Sending modifier keypresses to Bitwig doesn't seem to work. This is either
  6. ; a Windows, Bitwig or AHK issue.
  7. ; Last updated: October the 27th 2025, 7AM UT1
  8. ; - Now works with BwS6
  9. ; - Cleaned up a bit
  10.  
  11. #Requires AutoHotkey >2.0
  12. #SingleInstance Force
  13.  
  14. A_MenuMaskKey := ""
  15. A_ScriptName := "von Elsewhere's Space Pass"
  16. SetTitleMatchMode("RegEx")
  17.  
  18. OnExit exitFunc
  19. InfoTip(msg) {
  20.     TrayTip(msg, A_ScriptName, 1)
  21.     SetTimer((*) => TrayTip(), -1500)
  22. }
  23. InfoTip("Script running")
  24.  
  25. ; Isolate to Bitwig's plugin windows
  26. GroupAdd("BitwigPluginHost", "ahk_class vst3window ahk_exe BitwigPluginHost-X64-AVX2\.exe") ; BwS6
  27. GroupAdd("BitwigPluginHost", "ahk_class vst3window ahk_exe BitwigPluginHost-X86-AVX2\.exe") ; BwS6
  28. GroupAdd("BitwigPluginHost", "ahk_class vst3window ahk_exe BitwigPluginHost-X64-SSE41\.exe") ; BwS5
  29. GroupAdd("BitwigPluginHost", "ahk_class vst3window ahk_exe BitwigPluginHost-X86-SSE41\.exe") ; BwS5
  30.  
  31. #HotIf WinActive("ahk_group BitwigPluginHost")
  32.  
  33. ; Turn off and on the space bypass with Ctrl-Win-Alt-Space
  34. ^#!Space:: {
  35.     InfoTip("Plugin space bypass " . (spacer("flip") ? "enabled" : "disabled"))
  36. }
  37.  
  38. *Space:: {
  39.     if spacer() {
  40.         return
  41.     }
  42.     Send("{blind}{Space}")
  43. }
  44.  
  45. ~*Space up:: {
  46. }
  47.  
  48. #HotIf
  49.  
  50. ; SOME FUNCTIONS
  51.  
  52. spacer(cmd := "send") {
  53.     static spacePassEnabled := 1
  54.     static modifierKeysList := ["Shift", "Control", "Alt"]
  55.     if cmd == "flip" {
  56.         spacePassEnabled := !spacePassEnabled
  57.         return spacePassEnabled
  58.     }
  59.     if !(spacePassEnabled) {
  60.         return 0
  61.     }
  62.     if (A_ThisHotkey == A_PriorHotkey) {
  63.             return 1
  64.     }
  65.     if (BW_HWND := WinExist("^Bitwig\sStudio.* ahk_class bitwig ahk_exe BitwigStudioApp\.exe")) {
  66.         for i, v in modifierKeysList { ; Sending modifiers unfortunately doesn't seem to work, sorry
  67.             if (GetKeyState(v), "P") {
  68.                 ControlSend("{" . v . " down}", BW_HWND)
  69.             }
  70.         }
  71.         ControlSend("{Blind}{Space}", BW_HWND)
  72.         for i, v in modifierKeysList {
  73.             if (GetKeyState(v)) {
  74.                 ControlSend("{" . v . " up}", BW_HWND)
  75.             }
  76.         }
  77.         return 1
  78.     }
  79.     return 0
  80. }
  81.  
  82. exitFunc(*) {
  83.     InfoTip("Script stopping")
  84. }
Advertisement
Add Comment
Please, Sign In to add comment