Tried multiple variations to do that only when i paste texts to Musicbee using the default Windows keys or Right click+paste, but i couldn't make it work.
For the moment, i use this Code with AHK to alter what i copy to clipboard.
#NoEnv
#SingleInstance Force
#Persistent
OnClipboardChange("ReplaceClipboardText")
ReplaceClipboardText(Type) {
if (Type != 1) {
return
}
clipboard := RegExReplace(clipboard, "(feat\.|ft\.|&|\R|, )", " ")
clipboard := RegExReplace(clipboard, "\s+", " ") ; replace extra spaces with one
}
Code that works
only when you paste texts to MusicBee
#Requires AutoHotkey v2.0
#HotIf WinActive('ahk_exe MusicBee.exe')
^v:: { ; ^v = Paste replaced text
Static replace := ['feat.', 'ft.', '&', '/\r?\n/']
txt := A_Clipboard
For each, item in replace
txt := StrReplace(txt, item, ' ')
SendText Trim(RegExReplace(txt, '\h+', ' '))
}
#HotIf
You can replace ^v with something else to change the Hotkey.
This works with Ctrl+V but not with Right click and Paste command from within the context menu.
I only need to solve the last part now.
Updated, and i now i think i have the script i needed.The script is using the mouse wheel button (middle click) to select all and then paste the text while it replaces any unwanted string.
You may need to change the coordinates on "Send "{Click..."
#Requires AutoHotkey v2.0
#HotIf WinActive('ahk_exe MusicBee.exe')
MButton:: { ; Middle mouse button = Paste replaced text
Send "{Click 1585 47}"
Send "^{a}"
Static replace := ['feat\.', 'ft\.', '&', '\R', ', ', ' - ', ' – ', ' — ', ' vs. ', ' Featuring ']
txt := A_Clipboard
txt := RegExReplace(txt, "\([^()]*\)", "") ; Remove text within parentheses
For each, item in replace
txt := StrReplace(txt, item, ' ')
SendText Trim(RegExReplace(txt, '\h+', ' '))
Return
}
#HotIf