It is currently April 24th, 2024, 10:16 pm

Anyway to dynamically list data from the registry

Get help with creating, editing & fixing problems with skins
Valk
Posts: 2
Joined: July 9th, 2017, 1:56 pm

Anyway to dynamically list data from the registry

Post by Valk »

Hi,
I'm trying to list all the serial ports available in a dynamic list. At the moment I'm looking at pulling this data from the registry.

HKEY_LOCAL_MACHINE\Hardware\DeviceMap\Serial\
\Device\Serial[0...100]

I'd like to enumerate all the keys in \DeviceMap\Serial\ and list all the key values.

Alternatively, I could write a DLL to get the data in which case I'd probably get the port status and add filtering for special case serial ports, but that would still leave me with the same problem. How do I enumerate the devices and dynamically list them all?

The only other alternative I can think of is to build a long multi-line string (new to rainmeter so not sure how that idea will work).

Anyway, any hints or suggestions would be appreciated.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Anyway to dynamically list data from the registry

Post by SilverAzide »

Are serial ports still a thing? ;-)
Trying to enumerate a variable length list using Rainmeter won't really work all that well. But if a multi-line string is suitable, you could get it using a RunCommand measure. You use a WMIC query to get the list, something like:

Code: Select all

wmic path Win32_SerialPort get Caption, DeviceID
You'd get the output of this and use a series of substitutions to strip off the column heading and etc. Most machines I've tried this on return No Instance(s) Available., but if you have serial ports you should get a list.
Gadgets Wiki GitHub More Gadgets...
Valk
Posts: 2
Joined: July 9th, 2017, 1:56 pm

Re: Anyway to dynamically list data from the registry

Post by Valk »

Yes serial ports are still extremely useful. Especially in hardware development or debugging :D

Thanks for the idea (and example) of using wmic for pulling the data but unfortunately it doesn't pick up the USB devices. It did give me an idea to go down the powershell route which will make pulling extra details about the port much easier while not requiring a dll.

Now I just need to work on my regular expressions.