Feature Request: is device found

Announcements, questions
Post Reply
User avatar
Scratch
Posts: 6
Joined: 06 Nov 2015, 13:59

Feature Request: is device found

Post by Scratch » 05 Jun 2016, 11:02

Should return a boolean if a device exists / set to a name

My use case is that I have a keypad that changes ID every time I switch it's port.
I want to be able to check to see that the device is set up correctly on macro start

for example

Code: Select all

lmc_device_set_name('kp', '12AAE65F') --Set Device

if (!lmc_device_exists('kp')) then --Check if it did not work
lmc_print_devices() --so print out our list
lmc.minimizeToTray = false

end
unsure if you want to allow it to also take the device id

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

Re: Feature Request: is device found

Post by admin » 06 Jun 2016, 08:25

AFAIR function lmc_device_set_name returns string with real device name so I assume it return empty value if device is not found. This should solve your problem, please try.
Petr Medek
LUAmacros author

User avatar
Scratch
Posts: 6
Joined: 06 Nov 2015, 13:59

Re: Feature Request: is device found

Post by Scratch » 08 Jun 2016, 10:46

Perfect, managed to get it done with

Code: Select all

kp = lmc_device_set_name('kp', '25649703')

if (kp == "") then 
lmc_assign_keyboard('kp')  
I don't suppose you could add this functionality to the lmc_assign_keyboard function?
would save me having to list every device and instead just popping out what devices need configuring in the buffer

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

Re: Feature Request: is device found

Post by admin » 09 Jun 2016, 08:47

Could be done, noted...
Petr Medek
LUAmacros author

Post Reply