LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to read serial port descriptions?

Ok, I am using a chip that runs through a virtual serial port.  I am looking to identify it on the system so the user does not have to find out which one it is and select it from a drop down.  I'm looking to be able to read the little descriptions you get in the device manager under WinXP.  Under "Ports(COM & LPT)" you get - "Communications Port (COM1)", "ECP Printer Port(LPT1)", .... ect.  I'm wondering if there is a way to read the "Communications Port" or the "ECP Printer Port" parts of this string.  Is this possible, if so how?  Thanks in advance.
 
Greycat
0 Kudos
Message 1 of 13
(4,955 Views)
See this thread to read registry info for comm ports. Open regedit and see if the info you want is in this subkey area.
 
0 Kudos
Message 2 of 13
(4,941 Views)

Thanks unc

That might work out for me ... my only question is - it will always show up as VCP#, but if the customer already has a virtual com port installed when they install mine, this will assign it a different VCP# correct, I still might be able to work with this but is there anyway to read the description part of the serial port like the way you see it in Device Manager (I'm assuming that the description probably comes from the driver for the device, maybe a dll call would do it for me)?  Any way to do the same for components on USB?

Thanks again ... even if it doesn't fix my issue, it is a very handy routine for getting all sorts of information ... thanks Smiley Happy

 

Greycat

0 Kudos
Message 3 of 13
(4,937 Views)
You can use .vbs scripting. I have put several examples on the forum for using this technique. Maybe even some .net stuff would work.
 
Message 4 of 13
(4,934 Views)

ok ... this might work for me but it is goin to take some playing with to get the information I need ... the serial port one does not return my virtual com port ... but I have found my instrument under plugnplay - I'm not quite sure if the informatino I need (com port of the device through the virtual com port) will be in there ... thanks ... a couple of questions .. I assume that vbs scripting is enabled on Win2000 and Win XP machines by default ... is this correct?  Can one turn it off? ... One other question ... how would you have a select statement with a where condition?  Is this possible with vbs scripting?  I attempted it but my SQL memory is pretty old ... any tips ... thanks agin unclebump this will come in handy for other things in the furture though I'm sure.

Greycat

0 Kudos
Message 5 of 13
(4,921 Views)
Scripting may have to be enabled on some systems. It depends on how tight the security settings have been setup. Do a google search for scriptomatic 2.0. It is a download that lets you select items to read and automatically creates the script for it. Then you can run it and see the info that it generates.
0 Kudos
Message 6 of 13
(4,912 Views)

I am attaching a VI which uses WMI to get the Serial Port Descriptions.  I am also attaching a VBScript to do the same.  You can get other properties of the SerialPort as well.  See the MSDN link on the diagram.

Hope this gives you some ideas.

-Khalid

PS:  This is a "quick-n-dirty" test VI.  At a minimum, all references need to be closed, and errors handled, etc.

Message 7 of 13
(4,895 Views)

Hi Khalid,

 

Could you save that vi as a 7.0 format if possible. I'm curious how you called the .wsf file.

0 Kudos
Message 8 of 13
(4,866 Views)

Hi UncleBump,

I am not calling the WSF script, but using .NET controls to query the WMI Class directly.  Attaching the VI as 7.0 version.

-Khalid

Message 9 of 13
(4,862 Views)
I have not tried this yet (a little too busy with other stuff)... it looks promising.  One question though ... is there any way to include the .NET framework in a build using Labview 8?  Or does it have to be installed seperately on all machines that app is deployed to?
 
Greycat
0 Kudos
Message 10 of 13
(4,822 Views)