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.
It is currently May 4th, 2024, 10:05 am
Anyway to dynamically list data from the registry
-
- Posts: 2
- Joined: July 9th, 2017, 1:56 pm
-
- Rainmeter Sage
- Posts: 2617
- Joined: March 23rd, 2015, 5:26 pm
Re: Anyway to dynamically list data from the registry
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:
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.
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
-
- Posts: 2
- Joined: July 9th, 2017, 1:56 pm
Re: Anyway to dynamically list data from the registry
Yes serial ports are still extremely useful. Especially in hardware development or debugging
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.
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.