Assign a keyboard in the start of the script

Announcements, questions
Post Reply
un_pogaz
Posts: 9
Joined: 05 Feb 2019, 09:40

Assign a keyboard in the start of the script

Post by un_pogaz » 05 Feb 2019, 10:31

The problem is simple:
When I run my script, I know exactly which keyboard I will use for my Macro.
But it is impossible to find out how to automatically assign it to the "handler" .
The objective of this script is to be launched at the same time as Windows (registre key, command line "LuaMacros -r srcipt.lua")
Thank you for helping me.

Incidentally, the documentation seems incomplete to me: the overload "lmc_send_keys('Hello world', 100)" is not mentioned (what is the number for?). Another one without a doc : "lmc_send_input(51, 0, 0)".

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Assign a keyboard in the start of the script

Post by admin » 05 Feb 2019, 21:06

Assigning keyboard (fixed) name is decribed in how-to section of this forum - see viewtopic.php?f=12&t=248
These days I'm improving wiki pages at github and device names is one of the topics that will show up soon.
Yesterday I added page about keyboard triggers - see https://github.com/me2d13/luamacros/wiki/Triggers
Petr Medek
LUAmacros author

un_pogaz
Posts: 9
Joined: 05 Feb 2019, 09:40

Re: Assign a keyboard in the start of the script

Post by un_pogaz » 06 Feb 2019, 10:09

Ok thank.
However, I notice that the ID is lost in the middle of a large alphanumeric mush, it would be convenient to extract it and display it separately (ID: <ID>)
Another good thing would be a function that lists the devices in a table.

Feature request :
lmc_get_devices() would give a table in the format { { "Name", verbosUUID, ID }, { "Name", verbosUUID, ID }, ... } . This will allow us to perform analysis processing and display the information we are interested in.

Code: Select all

local devices = {};
devices  = lmc_get_devices();
for i, d = pairs(devices) do
  print("Name: " .. d[1]);
  print("VerbosUUID: " .. d[2]);
  print("ID: " .. d[3]);
end;
(In my project, there is a second script to test and get the ID of the device that will be used as MacroPad)

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Assign a keyboard in the start of the script

Post by admin » 06 Feb 2019, 11:07

That alphanumeric mush is exactly what is returned by Windows, you can take any part of the string that uniquely identifies the keyboard and pass it to lmc_device_set_name.

The feature you requested is already there and you guessed the function name right :-), see https://github.com/me2d13/luamacros/issues/19
Petr Medek
LUAmacros author

Post Reply