Ace9

Record Key Strokes Question

Recommended Posts

Hello, I am trying to record some key strokes in particular Shift+Ctrl+T (Ctrl+Shift+T) and the dialog window ends up saying "none", where as with Shift+Ctrl+R, this is repeated in the Key Record Window...

I have ensured that no other event is assigned to Shift+Ctrl+T inside P3Dv4 and otherwise. 

Shift+Ctrl+Y is another example that does not seem to record.

🙂 is there a restriction in Linda (3.0.9) - FYI I am using FSUIPC5.150 and can assign Shift+Ctrl+T (Ctrl+Shift+T) with it.

Cheers

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I will put my question another way...

Using the "Record Keypresses" feature of Linda 3.0.9 (64 bit) is anyone able to record the specific key combination "Ctrl + Shift + T" and assign it to a button ? If so are you then able to assign "Ctrl + Shift + Y"  to a button ? 

Share this post


Link to post
Share on other sites
2 hours ago, Ace9 said:

I will put my question another way...

Using the "Record Keypresses" feature of Linda 3.0.9 (64 bit) is anyone able to record the specific key combination "Ctrl + Shift + T" and assign it to a button ? If so are you then able to assign "Ctrl + Shift + Y"  to a button ? 

After much struggling, I have finally diagnosed that it appears that because "Shift + Ctrl + T" is listed in my RealityXP.GNS.ini - Linda (for some unknown reason) will not allow button assignment with this key combination. I think anyways.. The annoying thing that Linda is unaware of is, the button I wish to assign the key combination is for the Reality XP 530GNS V2 ..... 

I came to this conclusion after swapping "Shift + Ctrl + T" with "Shift + Ctrl + R" which Linda seemed to be happy to work with previously, but after amending the RealityXP.GNS.ini, changing T for R in the combination Shift + Ctrl + X, Linda would not allow key assignment with the recorded keypresses "Shift + Ctrl + R" which previously worked..

Could some one please explain why LInda is behaving like this and what I am doing wrong?

Cheers

Share this post


Link to post
Share on other sites

Hi Ace9

I am pleased you have sorted out you problem and sorry for the delay in responding. I had to open up the code to see what may be happening for answering - Keys is not something I normally use, preferring LINDA functions instead. As you have found, you can only assign key combinations to a button in LINDA if it is not already taken by another application. For example, you cannot assign CTRL+ALT+R as this is the hotkey defined to restart the LINDA LUA engine. Also the Flt Sim must have the focus for the simulated key press to have an effect. 

Share this post


Link to post
Share on other sites

Hi Andrew,

Many thanks for the reply, having used Linda since 2017 its about time I started to learn functions and to programme Lua 🙂 but where to start...

I have had a look at the Reality XP module (using Linda Editor) LIB: Reality XP (lib-realityxp.lua) that comes with Linda, am I right that the function for the Enter button on the GNS530 is

function RXP_530_ENT ()

    ipc.keypress(121,19)

end

If so, all I need to do is figure out what ipc.keypress(121,19) is all about, this function does not appear to work? But I reckon its me.

Reading the Reality XP users guide from keyboard shortcuts onward, advises me that the RealityXP.GNS.ini needs to be completed with keys added, eg..    

TOGGLE_WINDOW_1 = ALT+SHIFT+1  
OBS_1 = CTRL+SHIFT+A
MSG_1 = CTRL+SHIFT+B
FPL_1 = CTRL+SHIFT+C
VNAV_1 = CTRL+SHIFT+D
PROC_1 = CTRL+SHIFT+E
ENT_1 = CTRL+SHIFT+F    
CLR_1 = CTRL+SHIFT+G
MNU_1 = CTRL+SHIFT+H

I assume this needs to be done before the Linda module lib-realityxp.lua can be used ?

I hope you can shed some light on this please, beause I seem to be stuck in a big rut no being able to move forward... OK ....functions, im on it...

Cheers

Roger

Share this post


Link to post
Share on other sites

Hi Roger

The lib-RealityXP.lua is an old one from before my time. However, I believe you are correct to assume the functions listed do perform the action described. They call the same ipc.keypress FSUIPC library calls that the Key Press function does. Provided the code sequence is correct it should have the desired effect. Remember that the Flt Sim must have focus for the simulated key press to work. I would suggest you try assigning some of the functions from the RealityXP library and see what effect you get. If some buttons are missing I could guide you to write you own extra functions.

Share this post


Link to post
Share on other sites

Hi Andrew,

Copy that about the Flt Sim focus... 🙂 

I will experiment now and get back to you with results.

Any help you can give is very much appreciated, thank you.

Share this post


Link to post
Share on other sites

Hi Andrew,

To be safe, I have installed a clean copy of Linda and set it up from new....

With P3D in Focus, 🙂 I tested  all of the LIB: Reality XP module

GNS530 Buttons | GNS530 Knobs | WX500

Everything failed to work.

I have had a look at the FSUIPC manuals concerning the function above,  ipc.keypress(121,19) it will take a little help for me to fully understand the button codes... (121,19)  which as far as I can make out means (F10,Pause) which makes no sence to me at all.

Thanks again

Roger

Share this post


Link to post
Share on other sites

Hi Roger

If you look at the lib-RealityXP.lua in the Editor you will see what the codes refer to. I do not have any knowledge of the GNS as I do not have a copy. Therefore, I am unable to carry out any testing or offer you further practical advice.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Andrew.

Many thanks for the reply and you help. 

My problem runs a little deeper I feel, or I am clearly missing something about RXP GNS set up... it is, to me at least, very complicated... I have posted on the RXP forum...  hoping to solve or shed some light on my issue... and have embarked on a Lua internet course as well... 😃 

I think I have figured out that ipc.keypress(121,19) is perhaps nonsense from the FSUIPC Advanced Doc which indicates the 121 is the F10 key and  the 19 seems, to me at least, to be meaningless in today's current document because the combination of added parameters cannot add up to 19.. ?? I stand to be corrected on this....

Perhaps it should actually be ipc.keypress(121,9) which would be Shift + F10..... I think.... 🤔

Edited by Ace9
typo

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Ace9

The ipc.keypress commands takes 2 parameters. The first is the key presses (121 = F10) and the second the shift function, ie. ctrl, alt, etc (9 - shift, 10 = ctrl, 11 = ctrl + shift, 17 = alt + shift, 18 = alt + ctrl, 19 = alt + ctrl + shift). You would need to look at the hexadecimal/binary to decode their meaning of the shift functions.

PS: 1001 = bit 1 shift.   1010 = bit 2 ctrl. 1100 = bit 3 alt

Edited by ScotFlieger
Shift bits added

Share this post


Link to post
Share on other sites

Hi Andrew,

Many many thanks for the explanation, I am learning or remembering I think ?

My understanding of Binary and Hex is a bit rusty but I can clearly see from your examples that 1001(bin) = 8+1(dec) = 9(dec) = Shift etc... (which is explained in the FSUIPC advanced guide, section below) 

Where you say 19=alt+ctrl+shift , the 19 in  ipc.keypress(121,19)  refers to a HEX value not Binary or Decimal ?

So the 19(Hex) is equal to 25(dec) and now it makes sense because (using the guide below) alt(16)+ Normal(8) + Shift(1) = 25(dec) = 19(hex)

And there was me thinking it was either a typo or the FSUIPC list had changed ! 😃

All the best

Roger

The <shifts> value is a combination (add them) of the following values, as needed:

1 Shift
2 Control
4 Tab
8 Normal (add this in anyway)
16 Alt (take care with this one—it invokes the Menu)
32 Windows key (left or right)
64 Menu key (the application key, to the right of the right Windows key)

[Note that the Tab and Alt keys are denoted by opposite bits here than when used for key programming. Apologies for
this, which was a design oversight now too late to change]

If only “normal” is needed, the whole parameter and the preceding comma can be omitted. Usual values are:
9 for shift+…
10 for control+…
11 for shift+control+…

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now