This forum is read-only. Please post new topics in our Q&A forum.

Keystroke Input with Shift and Control

General discussion about MIDI Translator

Moderators: florian, DvlsAdvct

Post Reply
User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

Keystroke Input with Shift and Control

Post by florian » Sat Dec 31, 2011 11:05 am

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

User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

Re: Keystroke Input with Shift and Control

Post by florian » Sat Dec 31, 2011 11:08 am

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
New User
Posts: 3
Joined: Sun Sep 18, 2011 7:26 pm

Re: Keystroke Input with Shift and Control

Post by orchesterwart » Wed Jan 04, 2012 9:37 pm

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

Post Reply