Keystroke Input with Shift and Control

florian

2011-12-31 11:05:29

A user asked:
how can you create translators on keystroke combinations like Shift+Ctrl+D ?

florian

2011-12-31 11:08:28

The incoming Keystroke Action can only capture one key at a time (we will change this in future).

For key combinations, you will need to use global vars that capture the current modifier key status. Here is an example how to track Shift and Control:

Code: Select all

Translator 0: Shift Down
Incoming: Keystroke Down "Shift"
Rules: gs = 1
Outgoing: None

Translator 1: Shift Down
Incoming: Keystroke Down "Shift"
Rules: gs = 0
Outgoing: None

Translator 2: Control Down
Incoming: Keystroke Down "Control"
Rules: gc = 1
Outgoing: None

Translator 3: Control Up
Incoming: Keystroke Up "Control"
Rules: gc = 1
Outgoing: None
Now if gs is one you have currently Shift pressed, and the same for Control and gc.

Add a translator for Shift-Control-D:

Code: Select all

Translator 4: Shift+Control+D
Incoming: Keystroke "D"
Rules:
 if gs==0 then exit rules, skip outgoing action
 if gc==0 then exit rules, skip outgoing action
Outgoing: MIDI 90 40 7F
The Rules tell the translator to not be executed if either gs or gc are 0, i.e. not down.

Florian

orchesterwart

2012-01-04 21:37:26

Hi!

2 little changes an then works GREAT!

THX for the input!

Greets, Orchesterwart

Code: Select all

Translator 0: Shift Down
Incoming: Keystroke Down "Shift"
Rules: gs = 1
Outgoing: None

Translator 1: Shift Up
Incoming: Keystroke Down "Shift"
Rules: gs = 0
Outgoing: None

Translator 2: Control Down
Incoming: Keystroke Down "Control"
Rules: gc = 1
Outgoing: None

Translator 3: Control Up
Incoming: Keystroke Up "Control"
Rules: gc = 0
Outgoing: None