Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Browser Search & Load for Bitwig
- ;
- ; How to use:
- ; Write the trigger character (default: backitck) and
- ; then two letters abbreviation in the search field.
- ; The script will write a replacement search term,
- ; press tab for Everything, down arrow and then enter
- ; to load the search match.
- ; Make sure you don't trigger these elsewhere than in
- ; the browser search as you will get wonky behavior.
- ;
- ; For example, with this configuration, writing "`vi"
- ; without quotes to either browser's search should
- ; load Vital withhout further user interaction.
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- SetKeyDelay(2)
- SEARCH_DLY := 200 ; Delay time in ms that Bitwig needs to get the search done. Increase if 200ms isn't enough on your system.
- TAB_DLY := 30 ; Delay time that Bitwig needs to switch to Everything in the popup browser
- INPUT_TIMEOUT := 500 ; After writing the trigger character you need to write the rest within this ms value.
- make_autoloader()
- make_autoloader() {
- trigger := "``" ; Trigger character for autoload hotstrings that need to be written before the abbreviation. Note that the backtick is escaped with another backtick here.
- ; sarchTerms map contains the abbreviations you need to write after the trigger and the search terms that gets passed to Bitwig
- ; The abbreviation can contain any number of characters but be aware that f.ex. "eq" would trigger before "eq5".
- ; Follow the syntax of the example below.
- searchTerms := Map(
- "vi", "vital vst3",
- "sr", "serum vst3",
- "pp", "phase plant vst3",
- "e5", "eq-5 bwd", ; Writing "bwd" to the search term searches only .bwdevices (unless some other device name includes "bwd")
- "chr", "chorus -{+} bwd", ; Using only "ch" here would make it impossible to trigger "chp"
- "chp", "chorus{+} bwd" ; Note that plus sign needs to be written in curly brackets as "{+}" for search terms in this script.
- )
- ; Everything below this just does what needs to be done
- HotIfWinActive("ahk_class bitwig")
- for abbrv, searchString in searchTerms {
- Hotstring(":*B0:" trigger abbrv, autoLoad.Bind(,searchString))
- }
- Hotkey("~" trigger, autoLoad.Bind(,""))
- HotIfWinActive()
- autoLoad(hs, searchString := "") {
- static startT
- if (SubStr(hs, 2, 1) == trigger) {
- startT := A_TickCount
- return
- }
- if (A_TickCount - startT > INPUT_TIMEOUT) {
- return
- }
- if searchString {
- Send("+{Home}{Del}")
- SendEvent(searchString)
- Sleep SEARCH_DLY
- Send("{Tab}")
- Sleep TAB_DLY
- Send("{Down}{Enter}")
- }
- }
- }
- #HotIf WinActive("ahk_class bitwig")
- #HotIf
Advertisement
Add Comment
Please, Sign In to add comment