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!
alternative for "DriverNames" under Win32
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
alternative for "DriverNames" under Win32
Kind regards,
Andreas Rozek
Andreas Rozek
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.
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.