I am running OSC on a PC (win10) that also is running Cubase 10.5 using a second touchscreeen mionitor - all works fine. However, there is an issue with windows focus.
If I press a button on my OSC template on the touchscreen monitor, the relevant control is sent fine, but off course, windows has now focused on the touch OSC window and not Cubase. If I then use for example, a shortcut keyboard (qwerty keyboard), I have to manually use the mouse to refocus windows back to Cubase, then my shortcut keyboard works.
Is there a way that after each keypress on OSC, it sends a command to bring the main cubase window back to focus?
I apologise if this is a very simple question - I have googled it but can’t find an answer. I hope someone could help
Many thanks for the reply - I had previously used a piece of software to control Cubase which had options to pull windows to focus - so you could add that AFTER a key stroke, thus returning Cubase as in focus. I’m not a programmer so have no idea how to achieve something like that.
You should be proud of the software you have developed - very good indeed
Thank you. I’ve added a new function to the script widget (and the widgets’ script property): calling unfocus() will tell the OS to give the focus to the previously focused window. It will only work with the built-in client, not with external browsers.
Hi, i would like to add the exact same fonction to my OSC project but i can’t find where i should add this line “unfocus()” … Is it in a script widget or in the script value of my already programmed widgets ? Should i just tape in “unfocus()” ?
Ok great, thank you a lot i managed to make things working . One last question, what is the best way to implement this to the full project ? where should i past this ?
You could write a small custom module that triggers the script whenever an osc message is sent
module.exports = {
oscOutFilter:function(data){
// Filter outgoing osc messages
var {address, args, host, port, clientId} = data
// send back a message to trigger the widget with "unfocus()" in its script
receive('/script_widget_address', 1)
// return data if you want the message to be and sent
return {address, args, host, port}
}
}
I'm running into the issue of when I accidentally touch part of the screen that does not send a midi command. Might there be a way to address that situation?