Page 1 of 1
alternative for "DriverNames" under Win32
Posted: Sun Apr 13, 2008 8:03 am
by rozek
Hello!
How do I enumerate the available serial ports under Windows, MacOS and Linux? Is there an alternative for "DriverNames" which only works under MacOSX?
Thanks in advance for any help!
Posted: Wed Apr 16, 2008 4:31 pm
by n.allan
you could try something like:
put empty into tAvailibleComPorts
repeat with tCount = 1 to 9 --rev can only open COM1: to COM9:
put "COM" & tCount & ":" into tComPort --make up the com port name
open file tComPort for read --try to open the com port
if tComPort is among the lines of the OpenFiles then put tComPort & return after tAvailibleComPorts --If the com port is opened add it to the list of Availible com ports
close file tComPort --free the com port (optional)
next repeat
end repeat
Answer tAvailibleComPorts --Display a message with the list of availile com ports, one on each line.
Posted: Wed Apr 23, 2008 5:52 pm
by rozek
Thank your very much for your effort!
Now I have to find out if it is safe to "open" a serial port just to see if it exists...
Posted: Thu Apr 24, 2008 9:41 am
by n.allan
It won't be a problem.
If the COM port is not "safe" to open the result will contain "cannot open that file" else it will be empty.
Posted: Sat May 03, 2008 6:41 am
by rozek
Thank you very much for your posting!