Please help to merge two macros

I would like to merge two macros into one. Both macros work perfectly by themselves. But I have not managed to integrate the "addition" into the main macro "4".

What macro "4" does:
Macro "4" (exp).kmmacros (10.7 KB)

If "4" is pressed and held, global and/or app specific palettes open, depending on the front app. In addition, it moves the mouse to the palettes.

If "4" is released, all palettes close. And the mouse goes back to the original position.

If "4" is tapped briefly, then "4" is typed.

What „addition“ to macro "4" does
Addition to "4" (exp).kmmacros (3.1 KB)

If "4" is pressed and held, (= opt down) the status of the menubar changes (this is done with BTT). If "4" is released the menubar goes back to normal (= opt up).

Both macros work perfectly by themselves. But I have not managed to integrate the "addition" into the main macro "4".

Thanks for your help!

Grrrrrrrr... I'm about to go crazy. Either the menubar change works, but the palettes don't appear. Or the palettes appear, but the menubar change doesn't work.