Check rhino instances with rhinoscript

I am using Rhino script from my code no Rhinocommon but script.
When I am opening at first my application the rhinoscriptt open an instance of Rhino. Most of the time the behavior of my application doesnt work as expected.
So my question is how start the application-> open Rhino if no rhino instance, or check how many instance are available and take one of them?

the code when creating the object I have Implemented is

m_RhinoApp = CreateObject("Rhino.Interface.6") 

Dim nCount As Short
        ' Make attempts to get RhinoScript.
        ' Sleep between each attempt.
        nCount = 0
        Do While (nCount < 100)
            On Error Resume Next
            m_Rhino = m_RhinoApp.GetScriptObject()
            If Err.Number <> 0 Or IsDBNull(m_Rhino) Then
                nCount = nCount + 1
                Exit Do
            End If
        m_RhinoApp.visible = True

But from here I don’t see how many Instances are opened and I can’t take control of one of them.

Hi Markus,

If you want to create a new instance of Rhino, create a Rhino.Application object.

If you want to try to hook onto an instance of Rhino that is already running, create a Rhino.Interface object. Note, if more than one instance of Rhino is already running, there isn’t way to specify what instance to hook onto.

– Dale

Yes it helped a bit, perharps a better approch would be to look if there is a Communication still available between the Rhino object into my code and Rhino software. But I don’t find a function or a way to make it. Do you have any idea?

Hi @markus.erhardt,

Sorry, I don’t know what this means. Can you try to clarify? What problem are you trying to solve?


– Dale