Finding com ports programmatically in SharpCap?

Somewhere to ask questions about the best way to use SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Post Reply
tmnathe
Posts: 21
Joined: Fri Jul 29, 2022 4:13 am

Finding com ports programmatically in SharpCap?

#1

Post by tmnathe »

In working through Python programming ShartpCap with my Atlas Pro AZ/EQ mount (which requires using EQMOD to work), I'm finding that the com port sometimes comes up with a different location. As far as I can tell, SharpCap cannot read out what ports are available. There is a plugin called pyserial that will allow for that level of functionality but requires PIP to make it work, which SharpCap's version of IronPython doesn't have.

So is there a way to make this work and how do I go about doing that?

The two programs-
https://pyserial.readthedocs.io/en/latest/pyserial.html
https://pip.pypa.io/en/stable/getting-started/
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Finding com ports programmatically in SharpCap?

#2

Post by admin »

Hi,

the easiest thing when you encounter this sort of problem is to remember that IronPython is based on the Microsoft .NET framework, so C# code using the .NET framework can usually be translated fairly easily to IronPython. In this case.

Code: Select all

clr.AddReference("System.IO.Ports")
from System.IO.Ports import SerialPort
print (SerialPort.GetPortNames())
COM4 COM5 COM3
Hope this helps,

Robin
tmnathe
Posts: 21
Joined: Fri Jul 29, 2022 4:13 am

Re: Finding com ports programmatically in SharpCap?

#3

Post by tmnathe »

Ah-ha!
I'm not a programmer, so stuff like .NET or C# is way beyond me.
As it is, I'm barely understanding Python.

Thanks, Robin.
Post Reply