Any Key/Mouse Hotkey and Transfer

Hi everyone:
This an unusual question...I run keyboard Maestro on the new M1 MacBook Pro and run some iOS apps. I use an iOS app which is essentially a dictation(cloud based) microphone into another Mac OS app. I essentially use the space bar in the iOS app to simulate a touch in the center of the screen of the iOS app(a built in feature in Big Sur). Works very well. The issue is that when going to edit the dictated text, I often forget I am in the iOS app and start typing before realizing and switching to the MacOS app

I would like to set up a macro(s) to:

  • any key or key sequence (e.g. Command W) on the iOS app triggers a switch to the Mac OS app, a brief pause, then a repeat of the same key sequence(which was inadvertently entered in the iOS app). I have set up individual key sequences/keys(which work well) but I would like a macro for any key if that's possible
  • any mouse movement in the iOS app switches to the Mac OS app

Any suggestions much appreciated
I am a long time user but can't seem to find a way to do this

any mouse movement, or
any mouse movement when the iOS app is in front?

Sorry, should have been clearer. any mouse movement when the iOS app is in front.
Thanks for the prompt response

Also, should be any key besides SPACE. Space triggers the microphone.....simulates a touch

I have the solution for the "any key" part of your question (not the command-key nor the mouse moving part)
but it should get you quite close to solving your problem.

2 macros :

  • The first one continuously watch your keyboard input and will catch any character you type on your keyboard (so it will not fire with command-keys or arrows)
    To limit its scope,
    You have to put it in a group with the settings
    Available in these applications: Your iOS app
    any key.kmmacros (3.0 KB)

  • the second one can go into any group (global or else) as long as it can be active when either your iOS or macOS apps are at the front. Just change the name of the app from textedit to your macOS app.

paste key in Mac OS app.kmmacros (3.2 KB)

That is very elegant, thank you very much, much appreciated