Script below. It’s a CC trigger to switch between Gig Performer and Chrome (focus sheet music). I kept getting the error ‘cannot activate app: Google Chrome.app’ or the same for GP. I’m guessing it’s the issue mentioned in the manual… ‘Note that the operating system may not allow forcing the application focus under certain circumstances, so be sure to test the functionality.’
Debugging found 2 things.
The focus switch would work on the first attempt of either app. Subsequent focus changes to the other app would fail. (aside: requests to keep the first in front worked so long as it remained first in front)
Manually switching the focus back to MIDI translator would reset the issue. i could reproduce #1 for either application again.
Workaround. I put in a “Perform ‘Bome Focus’” before making the switch to either GP or Chrome. I delayed the GP and Chrome switch by 500ms to avoid race conditions. This worked fine, except the flash of Bome but that goes away when Bome is minimised.
I can live with this workaround but it was a pain to get to it. I hope there’s a fix
Bome 1.9.1
MacOS Sequoia 15.1.1 (24B91)
Macbook Air M1 (2020)
Script… it’s looking for a dial change on ch=15, cc=70. Up and Down show Chrome or GP respectively.
Project: MIDI-app-switch
Project MIDI IN ports: XPIANO73
_____________________________________________________________
[x] Preset 0: New Preset
[x] Translator 0.0: FXA-Param Change
Options: swallow
Incoming: FXA Parameter knob changes window focus, on port IAC Driver NumaXmapped
Rules:
sg=0
sc=0
if oo<gp then sg=1
if oo>gp then sc=1
Log "FXA Param UP... cc %oo% %gp% - GP:%sg% - CH:%sc%"
Perform "Bome Focus"
gp=oo
if sg>0 then Log "PARAM DOWN -> show GIG PERFORMER"
if sg>0 then Perform "Gig Performer Focus"
if sc>0 then Log "PARAM UP -> show GIG CHROME"
if sc>0 then Perform "Google Chrome Focus"
Outgoing: (none)
[x] Translator 0.1: Bome Focus
Incoming: On Perform "Bome Focus" with 0 parameters
Outgoing: Activating app: "Bome MIDI Translator Pro.app"
[x] Translator 0.2: Gig Performer Focus
Incoming: On Perform "Gig Performer Focus" with 0 parameters
Outgoing: Activating app: "GigPerformer5.app", delay:500 millisec
[x] Translator 0.3: Google Chrome Focus
Incoming: On Perform "Google Chrome Focus" with 0 parameters
Outgoing: Activating app: "Google Chrome.app", delay:500 millisec
If you share your project file, I can test it and also give you hints on how you can make it more reliable. Have you given consideration for the incoming action to tell Bome If it has application focus or not. For instance, perhaps if the application is already focused it gets confused so perhaps when Chrome is focused you set a global variable to 1 and when Gig Performer is in focus, set it to it to 2, then only have the application focus outgoing action execute if the desired application is not already in focus. I’ve also discovered that giving about 20ms for the focus action to complete before sending a keystroke makes in more reliable. Just put a 20ms delay on the keystroke after focusing the application.
Steve Caldwell
Bome Customer Care
Also available for paid consulting services: bome@sniz.biz
I wrote it again from scratch adding your suggestion that I don’t request focus for an app that already has focus. MIDI-app-switch-v2.bmtp (3.0 KB)
With new code I again found that
Bome must be in focus to be able to switch to another app focus
Bome can reliably request back the focus from any other app and this works if Bome is minimised.
Steps to reproduce this with the v2 file…
Change the Outgoing action on the ‘Bome Focus’ translator to None. Use the qwerty keyboard to switch between apps. Then trigger the app change by MIDI. The focus change only works if I manually focus on Bome. With any other app in focus there is a ‘cannot activate app’ error.
Change the Ongoing action on the ‘Bome Focus’ translator to a non-Bome app; e.g. Finder.app. Then use the MIDI trigger for focus change (no use of qwerty kbd). This time, if Bome has focus on the first trigger then I get Finder but then all subsequent requests get the error.
I’m still OK with this workaround and I do prefer the v2 with your improvement. I’d appreciate any improvement on the project file.
FYI, I’m not sending any keystrokes to the apps after switching. I just want to switch easily between viewing my charts in a browser or Gig Performer. My MIDI controller does have many buttons so I’m stuck using a knob.
This doesn’t seem right. I will test it. With that said, if you are sending keystrokes to Bome MIDI Translator Pro there is an option to ignore (or not) ignore keystrokes when Bome MIDI Translator Pro is focused. I assume you are focusing on Bome MIDI Translator Pro because it doesn’t allow focus otherwise? Again, I will need to test because I have never experience this behavior.
Thanks for sharing your project files! I will have a look.
Steve Caldwell
Bome Customer Care
Also available for paid consulting services: bome@sniz.biz
Well I tested it on my Mac and had not trouble, even when disabling the focus Bome Translator
I’m running Ventura 13.7.1 on Intel Core i5 and Bome MIDI Translator Pro V 1.9.1 built 1064. Maybe there is a user permission thing on your MacBook. I assume you have given Bome MIDI Translator Pro permissions in Privacy & Security → Accessibility.
Maybe it is a Silicon thing on your computer but I doubt it. It may, however be a permissions thing unique to Sequoia. It seems that every release of Mac, they tend to mess with permissions making things more restrictive.
At least you have a work-around in the meantime.
Steve Caldwell
Bome Customer Care
Also available for paid consulting services: bome@sniz.biz