# Focus another window, send the same keystroke then focus back on the previous window

**URL:** <https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205>\
**Category:** Bome Products\
**Created:** [May 3, 2024, 3:27pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205 "2024-05-03T15:27:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bensmir.hbs](https://forum.bome.com/letter_avatar_proxy/v4/letter/b/c37758/32.png) [@bensmir.hbs](https://forum.bome.com/u/bensmir.hbs)\
**Post date:** [May 3, 2024, 3:27pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/1 "2024-05-03T15:27:24Z")

</div>

Hello, I am looking to build a preset that does the following :

When the keyboard key ‘9’ is pressed

- If the window ‘Cubase Pro Project’ is in focus

1. Put the window ‘Key Editor’ in focus
2. Send the key ‘9’ again
3. Put the window ‘Cubase Pro Project’ in focus again

- If the window "\* If the window ‘Key Editor’ is in focus

1. Put the window ‘Cubase pro project’ in focus
2. Send the key ‘9’ again
3. Put the window ‘Key Editor’ in focus again" is in focus

The key ‘9’ perform a zoom to locators function, but since the zoom function in cubase is not in sync between the two windows, and I like working in split screen like that, I am looking for a way to sync the zoom.

I think it might be too complex to perform for BMT, the only application is the list of the outgoing action is ‘Cubase 13.exe’

Thanks

 ![image](https://forum.bome.com/uploads/default/original/2X/7/78cbc32dec500f64665e0abeccbed53536705bf5.png)

---

<div class="post-metadata">

**Author:** ![SteveC](https://forum.bome.com/user_avatar/forum.bome.com/stevec/32/8250_2.png) [@SteveC](https://forum.bome.com/u/SteveC)\
**Post date:** [May 3, 2024, 7:07pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/2 "2024-05-03T19:07:36Z")

</div>

Hi, please find the following. It should be pretty close but on 100%. You might need to play with the timing of the keystrokes a bit. Also I had to use as incoming keystroke instead of 9 because otherwise sending the keystroke would create an infinite loop of sending and triggering the incoming 9.

I use global variables ga and gb to determine which application is currently focused. I use the global variable gc to determine where to focus back once the keystroke is sent. I use a 200ms watchdog timer that triggers the return.

The rules, do a combination of determining what is focused to determine whether focus needs to be send an I use ‘Perform’ heavily within rules in the order I want things done.

I hope this at least gets you started.

[Keystroke-Redirection-2024-05-03.bmtp](https://forum.bome.com/uploads/short-url/k9psk9XXYHFIDB2UzMtWM2A8rgv.bmtp) (3.3 KB)

Steve Caldwell  
Bome Customer Care

* * *
_Also available for paid consulting services: bome@sniz.biz_

---

<div class="post-metadata">

**Author:** ![bensmir.hbs](https://forum.bome.com/letter_avatar_proxy/v4/letter/b/c37758/32.png) [@bensmir.hbs](https://forum.bome.com/u/bensmir.hbs)\
**Post date:** [May 3, 2024, 10:08pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/3 "2024-05-03T22:08:15Z")

</div>

Thanks !

Should I replace ‘notepad.exe’ with ‘Key Editor’ ? Because the second window is name ‘Key Editor’ but it doesn’t have a dedicated .exe

---

<div class="post-metadata">

**Author:** ![SteveC](https://forum.bome.com/user_avatar/forum.bome.com/stevec/32/8250_2.png) [@SteveC](https://forum.bome.com/u/SteveC)\
**Post date:** [May 4, 2024, 12:50am UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/4 "2024-05-04T00:50:54Z")

</div>

Ah, the application indeed will need to have an executable file (.exe). Is it a Windows Store application?

Steve Caldwell  
Bome Customer Care

* * *
_Also available for paid consulting services: bome@sniz.biz_

---

<div class="post-metadata">

**Author:** ![bensmir.hbs](https://forum.bome.com/letter_avatar_proxy/v4/letter/b/c37758/32.png) [@bensmir.hbs](https://forum.bome.com/u/bensmir.hbs)\
**Post date:** [May 4, 2024, 8:41pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/6 "2024-05-04T20:41:14Z")

</div>

nop, it’s a sub window within the cubase app!

---

<div class="post-metadata">

**Author:** ![SteveC](https://forum.bome.com/user_avatar/forum.bome.com/stevec/32/8250_2.png) [@SteveC](https://forum.bome.com/u/SteveC)\
**Post date:** [May 4, 2024, 9:23pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/7 "2024-05-04T21:23:44Z")

</div>

Too bad, maybe there is something in Cubase that you can use to navigate between Cubase Window. Some Daws have keystrokes for that.

Steve Caldwell  
Bome Customer Care

* * *
_Also available for paid consulting services: bome@sniz.biz_

---

<div class="post-metadata">

**Author:** ![SteveC](https://forum.bome.com/user_avatar/forum.bome.com/stevec/32/8250_2.png) [@SteveC](https://forum.bome.com/u/SteveC)\
**Post date:** [May 6, 2024, 1:13pm UTC](https://forum.bome.com/t/focus-another-window-send-the-same-keystroke-then-focus-back-on-the-previous-window/6205/9 "2024-05-06T13:13:54Z")

</div>

Well I was hoping the Cubase 13 could handle Windows injected events so I gave it a try but it doesn’t look that Cubase supports it. Well it was worth a shot.

Steve Caldwell  
Bome Customer Care

* * *
_Also available for paid consulting services: bome@sniz.biz_
