Soarer - Not clear on how "meta" directives work

r_avital

01 Jan 2019, 03:34

Hello all,

I've gotten great help here so far, many thanks to all!

Environment:
Northgate Omnikey Ultra (with additional "SF" keys across the top)
Soarer 1.0. firmware/tools

The additional "SF1 - SF12" keys, by default, function as Shift+F1 - Shift+F12. I was able to remap them so they send Alt+F1 - Alt+F12. Working great. Me so happy.

I've added the following to my .sc file:

Code: Select all

# BackQuote to Win
remapblock
	BACK_QUOTE LGUI
endblock
Flashed, working well. One problem: Backquote produces the desired effect, but Shift+Backquote, which is supposed to produce a tilde, is completely silent.

Do conditionals that apply to macros apply also to assignments? If so, how? I have the following among my macros:

Code: Select all

macro F6 shift -lalt -ralt  # 22 46
	PUSH_META SET_META lalt 
	PRESS F6
	POP_META 
endmacro
This works, because it specifies neither Alt key should be pressed, but either Shift key should be, which is what the keyboard sends when I press the SF6 key alone.

Optimally, I'd like to assign either GUI, LGUI or RGUI to this SF6 (and leave F6 and Backquote unmodified). Specifically, the SF6 key should produce only a "Win" key press, which is used (for instance, in Win7, the Win key all by itself brings up the menu at the lower-left of the screen).
So I'm not sure how to accomplish this, either with a macro or an assignment. I've tried this in my macro:

Code: Select all

macro F6 shift -lalt -ralt  # 22 46
	PUSH_META SET_META lgui 
	POP_META 
endmacro
.. but, no reaction at all.

Ideally, I would dearly love to assign "Win" to the "OMNI" key that sits in the middle of the arrow keys on this keyboard. hid_listen.exe does react when I hit it and produces:

Code: Select all

rE0 r12 +00 rE0 r73 
rE0 rF0 r73 -00 rE0 rF0 r12
The "00" corresponds to "UNASSIGNED" and using that in a remapblock gives an "invalid argument" error.

Thanks in advance!
Happy New Year!
Enjoy your New Years Eve, and stay warm and safe!

r_avital

02 Jan 2019, 02:55

Well, now I've done it. In my enthusiasm experimenting with macros, I've coded a MAKE (some meta key, probably ctrl) without a break. So obviously, on a win7 machine, every time I hit the "L" in any application like a text editor, my screen locks out.
I've managed to edit some .sc files with valid macros that compiled correctly (according to the return output from scaswr.bat), but nothing seems to undo this. Not even sending an empty .sc or one with nothing but a comment in it. Don't I feel stupid...

I don't deserve your help, but if anyone has any ideas how to recover from this, I'm all ears.

Thanks and again, Happy New Year.

User avatar
Muirium
µ

02 Jan 2019, 04:26

Tried power cycling the converter? Nulling out the config should destroy the misbehaviour. Don’t know quite what’s going on there.

If that fails, you might want to share your .sc code so we can take a look. Bung it in a [ code ] block in DT’s post editor and even a massive listing doesn’t take much room.

r_avital

02 Jan 2019, 12:08

Okay, power-cycled, back to normal.

Here's my current code:

Code: Select all

macroblock
macro F6
	MAKE LGUI
	onbreak norestoremeta
	BREAK LGUI
endmacro
macro F6 alt
	PRESS F6
endblock
The logic: The keyboard is set up (this is internal to the keyboard, nothing to do with SC) so that the row of SF keys, default to ALT+F1 ~ ALT+F12. That's what they actually send (verified this with a text editor that allows me to set ALT+F6 to do something, which worked when I hit SF6, so I know it's correct).

So, am I correct that the second macro in the block will execute only when ALT+F6 is pressed?
As it is, it executes only when the "straight" F6 is pressed, which is the opposite of what I'm looking for.

Just for grins, I modified "alt" to "-alt" and as expected, same result.
Any help would be greatly appreciated. THANKS.

User avatar
Muirium
µ

02 Jan 2019, 17:39

r_avital wrote: So, am I correct that the second macro in the block will execute only when ALT+F6 is pressed?
As it is, it executes only when the "straight" F6 is pressed, which is the opposite of what I'm looking for.
Yeah. The next thing I'd try is figuring out *which* alt key the keyboard's own controller is throwing on top of that function key. LALT and RALT are distinct signals, and you might have more luck triggering on just one of them. ALT is Soarer's shortcut for either of them, so it's generally fine to use, but you're having to work around something here so a little specificity could be good.

Also, just for debugging's sake, I'd make the macro fire something easily spotted, like J for instance, instead of the unmodified key. Just so you can nail the trigger condition, without confusion with the F6 key. Could be something funny going on regarding a macro firing the same key that it's triggered by.

r_avital

02 Jan 2019, 18:27

Deleted, just to be quieter. Better info in my following post. Admins feel free to remove this.
Last edited by r_avital on 03 Jan 2019, 02:59, edited 1 time in total.

r_avital

03 Jan 2019, 02:57

Trying to make sense of macro conditions:

Code: Select all

macroblock
macro F8 alt
	PRESS W
	push_meta set_meta lshift
	PRESS W
	pop_meta
endmacro
endblock
When I press Alt+F8, in the command window (Win7), I get "wW" as expected (though not in notepad, but I'm not worrying about that right now).

Code: Select all

macroblock
macro F8 lalt ralt
	push_meta set_meta lgui
	PRESS L
	pop_meta
endmacro
endblock
Here, I've eliminated any "ambiguity" as to which Alt key to listen for (though from all my testing, I can't see where there could be any).
This should lock the screen (Win+L) and show me the Win7 login screen. It does not. Hitting Alt+L in the command window simply shows a lower-case L. With focus anywhere else, no reaction whatsoever.
However:

Code: Select all

remapblock
	Q	lgui
endblock
Here, if I hit "Q" and "L" simultaneously, the screen does get locked and I do get a login screen.

What am I missing?
I need to do this because my keyboard has NO Win key.
I was hoping to avoid this, but I'm going to look into layers, if I can understand them first.

The goal is still the same: Assign Win key functionality to a Function key (combined with one of the metas, shift or alt).

I'd be grateful for any insights.
THANKS!

r_avital

03 Jan 2019, 19:19

I suppose I could get by with a conditional remapblock. I know remapblock within a macro is not allowed. If I can map lgui to an F key only if the F key is shifted, or Alt-ed, that would work for me.
Any ideas?
Thanks!

JBert

04 Jan 2019, 13:51

r_avital wrote: I've added the following to my .sc file:

Code: Select all

# BackQuote to Win
remapblock
	BACK_QUOTE LGUI
endblock
Flashed, working well. One problem: Backquote produces the desired effect, but Shift+Backquote, which is supposed to produce a tilde, is completely silent.
Remapblocks are unconditional and take effect before any macro is checked (you can see this in Soarer's documentation, there's a schema at the top of the Config page).

If you want to keep backquote as a Win key but still do some macro magic then you simply need to let your macro check for LGUI.
r_avital wrote: I suppose I could get by with a conditional remapblock. I know remapblock within a macro is not allowed. If I can map lgui to an F key only if the F key is shifted, or Alt-ed, that would work for me.
Any ideas?
Thanks!
I try to use Layers as much as possible, but at one point I have experimented with conditional macros instead of remapblocks. Here's something which might fit your case:

Code: Select all

macroblock
    macro F8 -shift
        MAKE F8
      onbreak norestoremeta
        BREAK F8
    endmacro

    macro F8 shift
        MAKE LGUI
      onbreak norestoremeta
        BREAK LGUI
    endmacro
endblock
My own code was different so I didn't test this, it might get the key stuck again...

r_avital

05 Jan 2019, 01:15

Thanks for the suggestion, JBert. I tested this. It produced no visible results that I could tell.

edlee

30 Apr 2020, 09:03

When you remap a key, you are effectively replacing the entire key with another key with all modifiers (shift, ctrl, alt, windows) affecting the remapped key as though it were the original key. So, if you just want the press of a back quote character to produce a press of LGUI (Left Windows key) and the press of Shift back quote to produce a tilde, you should create a macro for the back quote character instead of remapping the back quote character to LGUI. I remap the Right Alt key to be a windows key on my Gateway Anykey keyboard, because I never use the Right Alt key.

If you want to define Left Shift F6 to produce LGUI, you have to save the meta keys (shift, ctrl, alt, windows) and clear the meta keys before pressing LGUI or else the Left Shift will still be active and you will instead effectively be pressing LSHIFT LGUI instead of LGUI. Soarer considered making, "push_meta clear_meta all", the start of all macros by default and making, "pop_all_meta", the end of all macros by default but never got around to doing it. Soarer stated in one of his posts that macro definitions should be handed, where you specify either the Left Shift or Right Shift, Left Ctrl or Right Ctrl, Left Alt or Right Alt, Left Windows or Right Windows to be pressed.

remapblock
RALT RGUI
endblock

macroblock
macro BACK_QUOTE -shift -alt -ctrl -gui
press LGUI
endmacro

macro F6 LSHIFT -RSHIFT -alt -ctrl -gui
push_meta clear_meta all
press LGUI
pop_all_meta
endmacro

endblock

Post Reply

Return to “Keyboards”